I am looking for a way to change the following code:
foreach (Contact _contact in contacts)
{
_contact.ID = 0;
_contact.GroupID = 0;
_contact.CompanyID = 0;
}
I would like to change this using LINQ / lambda into something similar to:
contacts.ForEach(c => c.ID = 0; c.GroupID = 0; c.CompanyID = 0);
However that doesn't work. Is there any way to do multi-line in a linq foreach other than by writing a function to do this in one line?