1/4
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is LINQ?
LINQ (Language Integrated Query) is uniform query syntax in C# to retrieve data from different sources.
var evenNumbers = from n in numbers
where n % 2 == 0
select n;
What are the advantages & disadvantages of LINQ?
Advantages of LINQ
1. Easy and simple syntax to Learn
2. Improved code readability
3. Improved performance
4. Type safety
Disadvantages of LINQ
1. Limited support for some data sources
2. Difficult to maintain and debug
What is Lambda Expressions?
A lambda expression is used to simplify the syntax of anonymous methods.
var evenNumbers = numbers.Where(n => n % 2 == 0);
What is the difference between First and FirstOrDefault methods in LINQ?
First method will return the first value, but it is not able to handle null values.
Return error if null
FirstOrDefault will return the first value, and it is able to handle null values also.
Returns default value. EX: return 0 if null value