I have a list (MyList) of objects…and I would like to update one property (Priority) of each item in that list.
Will the below code work for that ?
this.MyList.All(
delegate(ItemViewModel itemObject)
{
itemObject.Priority = priority++;
}
)
Please help me. Thanks in advance!
Why not just use
foreach?If you really want to use a delegate you can use
ForEach():This is not advisable though since you introduce a side effect with
priority++