Reassign the list, ideally without mutating anything. This would be more consistent with the functional programming mindset of LINQ.
IEnumerable<MyObj> myList1 = EF.GetList(etc);
IEnumerable<MyObj> myList2 = myList1.Select( x =>
new MyObj
{
uploadedAt = MyUtils.ConvertToLocalTime(x.uploadedAtUTC, x.clientTimezone),
anyOtherFields = x.anyOtherFields
}
).ToList();
If constructing a MyObj is complicated and/or you really need to mutate it, you can also do this:
IEnumerable<MyObj> myList = EF.GetList(etc);
myList = myList.Select( x => {
x.uploadedAt = MyUtils.ConvertToLocalTime(x.uploadedAtUTC, x.clientTimezone);
return x;
}).ToList();
But if you're going to do it that way, you may as well use the for loop.
foreachseems to the cleanest way. Btw, there is no magic inLinq, it's still using looping under the hoodForEach, which does exactly what it seems to do :) Also there is asynchronous versionForEachAsyncForEachin LINQ? I am aware of no such method.MyList.ToList().ForEach(x=>...)