An Extensive Examination of LINQ: The Ins and Outs of Query Operators
Posted by: 4GuysFromRolla.com Headlines,
on 25 Mar 2009 |
View original | Bookmarked: 0 time(s)
As discussed in An Introduction to LINQ, LINQ is composed of three main components:
- Language Extensions,
- Standard Query Operators, and
- LINQ Providers.
The previous two installments - Extension Methods, Implicitly Typed Variables, and Object Initializers and
Lambda Expressions and Anonymous Types - explored the language extensions added to C# 3.0 and Visual Basic
9 that allow for LINQ's unique syntax. But these language extensions are merely syntactic sugar; they make it possible for developers to write more concise and readable code, but
they don't actually perform any operations. The real workhorse of LINQ is the standard query operators.
LINQ's standard query operators are a collection of query operators. Query operators are methods that walk through a sequence of data and perform some task based
on that data, and are implemented as extension methods on the
IEnumerable<T> interface. We've already seen a handful of standard query operators in use in
previous installments, such as
Average. This article explores the inner workings of query operators, which is essential
to understanding how LINQ's standard query operators work. Read on to learn more!
Read More >