Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query Notation for Select overload with index

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 ?


1 Answers

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.

like image 84
JaredPar Avatar answered Jul 28 '26 04:07

JaredPar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!