I defined a tuples in a for loop like this (From Leetcode 1704)
for (var tuple = (i : 0, j : s.Length / 2); tuple.i < s.Length / 2 && tuple.j < s.Length; tuple.i++, tuple.j++){...}
It worked properly.
Then I tried to explicitly define the variable type of the tuple.
This is the method I found on the Internet
for (Tuple<int, int> tuple = new Tuple<int, int>(i : 0, j : s.Length / 2); tuple.i < s.Length / 2 && tuple.j < s.Length; tuple.i++, tuple.j++)
And I got some errors
Line 7: Char 58: error CS1739: The best overload for 'Tuple' does not have a parameter named 'i' (in Solution.cs)
Line 7: Char 90: error CS1061: 'Tuple<int, int>' does not contain a definition for 'i' and no accessible extension method 'i' accepting a first argument of type 'Tuple<int, int>' could be found (are you missing a using directive or an assembly reference?) (in Solution.cs)
Line 7: Char 116: error CS1061: 'Tuple<int, int>' does not contain a definition for 'j' and no accessible extension method 'j' accepting a first argument of type 'Tuple<int, int>' could be found (are you missing a using directive or an assembly reference?) (in Solution.cs)
Line 7: Char 136: error CS1061: 'Tuple<int, int>' does not contain a definition for 'i' and no accessible extension method 'i' accepting a first argument of type 'Tuple<int, int>' could be found (are you missing a using directive or an assembly reference?) (in Solution.cs)
Line 7: Char 147: error CS1061: 'Tuple<int, int>' does not contain a definition for 'j' and no accessible extension method 'j' accepting a first argument of type 'Tuple<int, int>' could be found (are you missing a using directive or an assembly reference?) (in Solution.cs)
Line 9: Char 41: error CS1061: 'Tuple<int, int>' does not contain a definition for 'i' and no accessible extension method 'i' accepting a first argument of type 'Tuple<int, int>' could be found (are you missing a using directive or an assembly reference?) (in Solution.cs)
Line 10: Char 41: error CS1061: 'Tuple<int, int>' does not contain a definition for 'j' and no accessible extension method 'j' accepting a first argument of type 'Tuple<int, int>' could be found (are you missing a using directive or an assembly reference?) (in Solution.cs)
I want to know is it special to define a Tuple in a for loop? And how should I do it
(Of course it's clearer and easier to read with var... I just want to figure out how to do it without omitting.)