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();

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...