score:3

Accepted answer

This is not possible with LINQ expressions. You could use the following:

Quantities = numbers.Select((s, index) => new SelectListItem 
{ 
    Value = index.ToString(), 
    Text = s.ToString()
);

score:0

You can use the method syntax instead of the query syntax:

var quantities = numbers.Select((x,i) => {...});


Related Articles