3 ms·
LINQ is the name for the overall system. LINQ can be written using two different styles: // Method syntax var evenNumbers = numbers.Where(num => num %
by Merad 2y ago
LINQ is the name for the overall system. LINQ can be written using two different styles:
// Method syntax
var evenNumbers = numbers.Where(num => num % 2 == 0).OrderBy(n => n);
// Query syntax
var evenNumbers = from num in numbers
where num % 2 == 0
orderby num
select num;
Method syntax and query syntax are both part of LINQ (query syntax is syntactic sugar). .Net developers tend to overwhelmingly prefer method syntax.