while following code works fine wondering if there cleaner way accomplish lambda expressions?
var counter = 1; foreach (var item in model) { item.id = counter++; }
you make inline lambda foreach
model.foreach(x => x.id = counter++);
update/restriction:
- this work when
model
typelist<>
- in case of value types items won't updated - without error
Comments
Post a Comment