Ajay Kumar

Ajay Kumar

  • 1.3k
  • 926
  • 117.4k

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)