c# - How to assign index of the collection to property -
i have following linq query productionmachines.orderby(x => x.timedone).tolist(); want assign property x, index of it's location in collection. first productionmachines receive x equals 1 secound 2 , etc...
example productionmachines have 5 entries. productionmachine[0].x have 1 .. .. .. productionmachine[4].x have 5
use other form of select
productionsmachines.orderby(x => x.timedone) .select( (x,i) => { x.property = i+1; return x; });
Comments
Post a Comment