There is an overload of Select that adds an index to each element of the 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?
Jens
source
share