There is a Select overload that adds an index to each element of a sequence :
Dim Letters = new string() {"a","b","c","d","e"}
Dim IndexedLetters = Letters.Select(function (aLetter, index) new with {.Index = index + 1, .Letter = aLetter})
' For LINQPad users : IndexedLetters.Dump
Can this query be written in Query Notation ?
No untfortunately it cannot. The Select overload you mentioned is not one of the Select overloads that the VB.Net (or C#) compiler will bind to in query notation. You must write this one out by hand as your example shows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With