jonasalbert
1/24/2018 - 4:26 AM

Update List<T> without loop

Update List without loop

https://stackoverflow.com/questions/19929316/updating-single-column-of-list-without-foreach-loop


As the Q of LINQ says, the basic usage of LINQ is to query, not to update.

The less verbose form of foreach is the ForEach method of List<T>:

li.ForEach(z => z.MarksExamTotalOverAll = 50);


List<Myclass> li = new List<Myclass>();
 Parallel.ForEach(li, l => l.MarksExamOutOfMarksTotalOverAll = 50);