public class Company { public int id { get; set; } public int Name { get; set; } } List listofCompany = new List();
It can be done this way as well
foreach (Company company in listofCompany.Where(d => d.Id = 1)).ToList()) { //do your stuff here company.Id= 2; company.Name= "Sample" }