I want to do this:
list.Select((x, i) => new { Item = x, Index = i })
But in the LINQ query syntax, something like:
from x in list
select(x, i) { Item = x, Index = i }
But that doesn’t work. Or maybe there is another way to increment en scoped variable in the LINQ query?
No, there’s no form of C# query expression which uses that overload. Basically you have to do it as an extension method call to use that overload.