I am new to Linq.
I want to set two values in foreach statement like this
foreach
My actual code is this
foreach (Employee emp in employees
Try with this combination of Lambda expressions:
employees.ToList().ForEach(emp => { collection.AddRange(emp.Departments); emp.Departments.ToList().ForEach(dept => dept.SomeProperty = null); });