Click here to Skip to main content
15,920,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
string countryname = "India";
var StateCodes = ("012","016","15","11") // fetched data from database table


_EFContext.OfficeTbl.RemoveRange(_EFContext.OfficeTbl.Where(so =>so.country == countryname
&& so.State in StateCodes )));


achieved this using foreach loop but want to do using lambda and failed to use in condition appropriately, suggestion help will be appriaciated !

thanks!

What I have tried:

achieved this using foreach loop
Posted
Updated 24-Jun-21 2:33am
Comments
[no name] 11-Jun-21 14:01pm    
StateCodes.Contains( so.State )

 
Share this answer
 
thanks all,
this worked for me -
string countryname = "India";
var StateCodes = ("012","016","15","11") // fetched data from database table

_EFContext.OfficeTbl.RemoveRange(_EFContext.OfficeTbl.Where(so =>so.country == countryname
&& StateCodes.Contains(so.State)));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900