This sample demonstrates an indexed Where clause that returns digits whose name is shorter than their value. Source Code
public void Linq5()
{
string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
var shortDigits = digits.Where((digit, index) => digit.Length < index);
Console.WriteLine("Short digits:");
foreach (var d in shortDigits)
{
Console.WriteLine("The word {0} is shorter than its value.", d);
}
}
Now My Question is ...Can we write this in the LINQ Query format like:
from u in digits where u.Length>index select u;
Here How to get the INDEX value from above Query?