|
Hi,
What I needs to do the following routine make work.
public Tuple<int, int, int, int, int, int, int, Tuple<int>> CreateNewTuples1()
{
return Tuple.Create(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8));
}
But i got the following error.
//Error 1 Cannot implicitly convert type 'System.Tuple<int,int,int,int,int,int,int,System.Tuple<System.Tuple<int>>>' to 'System.Tuple<int,int,int,int,int,int,int,System.Tuple<int>>'
So I've changed my code as the following one.
public Tuple<int, int, int, int, int, int, int, Tuple<Tuple<int>>> CreateNewTuples()
{
return Tuple.Create(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8));
}
Is it the right way? If not, what's wrong with the first method?
Used Visual C# Express Edition 2010 Beta 2.
|
|
|
|
|
Hi,
For 8-tuple or octuple, the return parameter is a bit different from others. In case of octuple the create method will return Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8>>. So you don't need to put Tuple.Create(8) inside Tuple.Create. Your code should be:
public Tuple<int, int, int, int, int, int, int, Tuple<int>> CreateNewTuples1()
{
return Tuple.Create(1, 2, 3, 4, 5, 6, 7, 8);
}
|
|
|
|
|
Thank you for immediate response and for your information. Actually, I was looking on tuples to use more than 8 like 'TRest'. And I found the MSDN pages <a href="http://msdn.microsoft.com/en-us/library/dd383325(VS.100).aspx">http://msdn.microsoft.com/en-us/library/dd383325(VS.100).aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/dd383325(VS.100).aspx" target="_blank" title="New Window">^</a>]
|
|
|
|