Namespace: System.Linq
The System.Linq namespace provides classes and interfaces that support queries that use Language-Integrated Query (LINQ).
Classes
| Name | Description |
|---|---|
| Enumerable | Provides a set of static methods for queries that return IEnumerable |
| Queryable | Provides a set of static methods for queries that return IQueryable |
| ParallelEnumerable | Provides a set of static methods for parallel queries. |
| Expressions | Contains classes that enable language-level code expressions to be represented as objects in the form of expression trees. |
Interfaces
Sample Code
using System;
using System.Linq;
using System.Collections.Generic;
class Demo
{
static void Main()
{
var numbers = new List<int> { 5, 3, 9, 1, 7 };
var even = numbers.Where(n => n % 2 == 0);
var sorted = numbers.OrderBy(n => n);
Console.WriteLine(string.Join(", ", sorted));
}
}