Is it possible to have a counter going up when creating a Linq query returning an anonymous object?
E.g.
var results = from foo in bar select new { foo.ID, foo.Name, Counter = ???? }
I already tried defining a method which returns an increasing number, but the end result will be the same for all objects.
To clarify: I want the result to be
id, name, 1
id, name, 2
id, name, 3
Etcetera
1 Answer