This seems like a completely basic question, but, in my opinion, I cannot work out an elegant solution.
Basically, I am making a LINQ query creating a new object from the query. In a new object, I want to generate an automatically increasing number so that I can keep the selection order for later use (named Iter in my example).
Here is my current solution that does what I need:
Dim query2 = From x As DictionaryEntry In MasterCalendarInstance _ Order By x.Key _ Select New With {.CalendarId = x.Key, .Iter = 0} For i = 0 To query2.Count - 1 query2(i).Iter = i Next
Is there a way to do this in the context of a LINQ query (so I don't need to loop the collection after the query)?
Nathan
source share