Query Operator Overview
The sections that follow describe each of the LINQ query operators, as summarized in Table 1-1.
Table 1-1. LINQ query operators
Category | Operators |
|---|---|
Filtering | |
Projecting | |
Joining | |
Ordering | |
Grouping | |
Set | |
Conversion import) | |
Conversion export) | |
Element | |
Aggregation | |
Quantifiers | |
Generation | |
The examples assume that a names array is defined as follows:
string[] names = { "Tom","Dick","Harry","Mary","Jay" };Examples that use LINQ to SQL assume a typed DataContext variable called dataContext:
var dataContext = new DemoDataContext();
...
public class DemoDataContext : DataContext
{
public DemoDataContext (string cxString)
: base (cxString) { }
public Table<Customer> Customers
{ get { return GetTable<Customer>(); } }
public Table<Purchase> Purchases
{ get { return GetTable<Purchase>(); } }
}
[Table] public class Customer
{
[Column(IsPrimaryKey=true)] public int ID;
[Column] public stringName;
[Association(OtherKey="CustomerID")]
public EntitySet<Purchase>Purchases = new EntitySet<Purchase>(); } ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access