Monday, March 30, 2009

An Extensive Examination of LINQ: The Ins and Outs of Query Operators


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 Where, Count, and 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 >

0 comments:

Post a Comment

Copyright 2009 - Aspnetr.com

Site by Infonex.com