A New Internet Library: Add Your Website/Blog or Suggest A Website/Blog to our Free Web Directory http://anil.myfunda.net.

Its very simple, free and SEO Friendly.
Submit Now....

Wednesday, February 13, 2008

The LINQ Architecture

The LINQ Architecture

In scanning the examples in the previous section, you probably noticed use of the var keyword, as well as the use of the new keyword without an accompanying class name. What you see are two new features of C# 3.0, namely type inference and anonymous types, added to the language in support of LINQ. Additional language features include query expressions, lambda expressions, expression trees, extension methods, and object initializers, all of which will be explained in the following sections.



LINQ's architecture is designed around a high-level, collection-like abstraction. This means that LINQ queries are written in C# 3.0 against the notion of an object collection, and then translated by the compiler into IL for execution against a particular data source (see Figure 1). This provides many benefits, including:

  • Ability to target different data sources, e.g. databases and XML documents.

  • Ability to use LINQ with existing .NET 1.* and 2.0 objects.

  • Ability to extend LINQ to support new classes and technologies.

As an analogy, consider the foreach loop. The foreach is merely syntactic sugar for a while loop written against the IEnumerable and IEnumerator interfaces. However, foreach represents a convenient and powerful abstraction, allowing intuitive iteration across different types of collections, today and in the future. It's now hard to imagine C# or VB without foreach.



No comments:

Post a Comment

Post your comments here:

Dotnet-Interviews