What Is LINQ? And why LINQ?
What Is LINQ?
At the Microsoft Professional Developers Conference (PDC) 2005, Anders Hejlsberg and his team presented a new approach, Language-Integrated Query (LINQ), which unifies the way data can be retrieved in .NET. LINQ provides a uniform way to retrieve data from any object that implements the IEnumerable<T> interface. With LINQ, arrays, collections, relational data, and XML are all potential data sources.
Why LINQ?
With LINQ, you can use the same syntax to retrieve data from any data source.
var query = from emp in employees
select emp.name
This is not pseudo code, this is LINQ syntax, and it’s very similar to SQL. The LINQ team’s goal was not to add yet another way to access data, but to provide a native, integrated set of instructions to query any kind of data source. Using C# keywords, we can write data access code as part of C#, and the C# compiler will be able to enforce type safety and even logical consistency. LINQ provides a rich set of instructions to implement complex queries that support data aggregation, joins, sorting, and much more.
The three main parts of the LINQ project:
- LINQ to Objects is an API that provides methods that represent a set of standard query operators (SQOs) to retrieve data from any object whose class implements the IEnumerable<T> interface. These queries are performed against in-memory data.
- LINQ to ADO.NET augments SQOs to work against relational data. It is composed of three parts: LINQ to SQL (formerly DLinq) is use to query relational databases such as Microsoft SQL Server. LINQ to DataSet supports queries by using ADO.NET data sets and data tables. LINQ to Entities is a Microsoft ORM solution, allowing developers to use Entities (an ADO.NET 3.0 feature) to declaratively specify the structure of business objects and use LINQ to query them.
- LINQ to XML (formerly XLinq) not only augments SQOs but also includes a host of XML specific features for XML document creation and queries.
Incoming search terms for the article:
what is linq and why Linq, why linq requierd, why LINQ, whats is ref and out in c sharp, why linq is required, what are the compression techniques for web pages, what and why linq, three main components of LINQ, net - why linq ?, linq how to linq, linq c sharpcorner