Pages

Subscribe:

Ads 468x60px

Saturday, March 17, 2012

what is LINQ

LINQ (Language Integrated Query) is a set of extensions for the C# and Visual Basic languages. It allows
you to write C# or Visual Basic code that manipulates in-memory data in much the same way you query
a database.
Technically, LINQ defines about 40 query operators, such as select, from, in, where, and orderby (in
C#). These operators allow you to code your query. However, there are various types of data on which
this query can be performed, and each type of data requires a separate flavor of LINQ.
The most fundamental LINQ flavor is LINQ to Objects, which allows you to take a collection of
objects and perform a query that extracts some of the details from some of the objects. LINQ to Objects isn’t ASP.NET-specific. In other words, you can use it in a web page in exactly the same way that you use it in any other type of .NET application.
Along with LINQ to Objects is LINQ to DataSet, which provides similar behavior for querying an inmemory DataSet object, and LINQ to XML, which works on XML data. But one of the most interesting flavors of LINQ is LINQ to Entities, which allows you to use the LINQ syntax to execute a query against a relational database. Essentially, LINQ to Entities creates a properly parameterized SQL query based on your code, and executes the query when you attempt to access the query results. You don’t need to write any data access code or use the traditional ADO.NET objects. LINQ to Objects, LINQ to DataSet, and LINQ to XML are features that complement ASP.NET, and aren’t bound to it in any specific way. However, ASP.NET includes enhanced support for LINQ to Entities, including a data source control that lets you perform a query through LINQ to Entities and bind the results to a web control, with no extra code required.

No comments:

Post a Comment