As discussed in An Introduction to LINQ, one of the cornerstones of LINQ is the
standard query operators, which are a set of extension methods on the IEnumerable interface added to the .NET Framework version 3.5. The standard
query operators can be applied to any enumeration - any collection of "things." In The Standard Query
Operators installment we looked at some of the more common query operators, such as Where, Select, OrderBy, and others.
Each standard query operator can be classified as a certain type of operator. There are aggregation operators like Count, Sum, and Max;
element operators like First, Last, and ElementAt let you pick out a specific element from a sequence; and the ordering operators
OrderBy and OrderByDescending order the elements of a sequence based on a specified sorting criteria.
Another class of query operators that we've yet to explore are grouping and joining operators. The grouping and joining operators work with two (or more) sequences
and combine them together, much like how a JOIN in SQL combines records from two (or more) tables into a single resultset. Through LINQ's standard query operators
(or via its query syntax), it is possible to perform: nested (or grouped) queries; cross joins, or
the Cartesian product of two sequences; inner joins; and left outer joins.
This article explores the grouping and joining operators available in LINQ with a number of examples in both Visual Basic and C#. As with the previous installments in this
article series, the complete code is available for download. Read on to learn more!
Read More >