Using the operator AND in LINQ

Recently , I had received an query from one of my blog readers asking the question related to SQL and LINQ .

“In SQL , we can use AND operator when checking for multiple conditions , what is the equivalent of AND in LINQ in c#” ?

This is a simple one .

You can use the && operator in LINQ .

For example , AND operator in LINQ can be used as shown in the below example

var movie = (from m in movies

where m.Name == "Thuppaki" && m.comedian =="satyan").FirstOrDefault();
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply