Ajay Kumar

Ajay Kumar

  • 52
  • 29.1k
  • 1.5m

Multiple Operation in linq Foreach in c#

Feb 23 2022 10:07 AM

There is A situation where i have currently used Foreach inside the linq

 db.retailer_comm.Where(w => w.optcode == aa.optcode && remlist.Contains(w.userid)).ToList().ForEach(i => i.comm =aa.comm);

The Above Statement is Working Fine, But I want to add two more operation inside the Foreach, like this 

 db.retailer_comm.Where(w => w.optcode == aa.optcode && remlist.Contains(w.userid)).ToList().ForEach(i => i.comm =aa.comm ,  i.comm1=aa.comm1);

But It's Give me Error, So How Can i Solve This Problem


Answers (2)