RSSCategory: Linq

Apr

5

LINQ – SQL Wildcard Equivalents

Posted by Leave a Comment

LINQ has several ways to mimic SQL wildcards in both query and method syntax. Below are a few examples of each:

Continue Reading

Apr

3

LINQ Single vs SingleOrDefault vs First vs FirstOrDefault

Posted by 33 Comments

Many people get confused about the difference between Single, SingleOrDefault, First, and FirstOrDefault methods in Linq. Below is a chart explaining the difference between them and examples of each scenario.

Continue Reading

Mar

22

LINQ Select vs SelectMany

Posted by 7 Comments

The best way to explain the difference between Select and SelectMany in Linq is to show an example. In this example we will return a list of courses, each containing a list of students. You will see that Select will return a list of lists of students while SelectMany will flatten the lists into a single list of students.

Continue Reading