Update all properties in list using linq

asp.net-mvc, linq, linq-to-sql

Solution

You should be able to do it simply via `ForEach`..

users.ForEach(user => user.email = sessionEmail);

or for multiple properties..

users.ForEach(user => 
{
    user.email = sessionEmail;
    user.name = "Some Person";
    ...
});

Problem

I need to update all the properties in a list object using linq. For ex.: I have an User List with (Name, Email, PhoneNo,...) as properties. I will get the Users List(`List<Users>`) from database which is filled with all properties except Email. I need to update all the Email property in the list after retrieving from database with some email in session. How can i do it?

Original source