score:6

Accepted answer
return enumerable.Select((e, i) => new KeyValuePair<int, T>(i, e));

Also note that your approach using i++ as a captured variable is not safe; someone could call Count() first, for example - of use Parallel.


Related Query

More Query from same tag