Request designation for selecting overload with index

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?

+3
source share
1 answer

No, unfortunately, this is not possible. Select overload Select is not one of the selected overloads with which the VB.Net (or C #) compiler will bind to the request notation. You must write this manually, as your example shows.

+2
source

Source: https://habr.com/ru/post/1710758/


All Articles