1. What is
LINQ
?2. Why we need
LINQ
?3. Advantage of
LINQ
What is LINQ?
LINQ is a short form of Language Integrated Query and it is mainly used for querying data (save and retrieve data) from a different data source like SQL Database, XML Documents, ADO.Net Dataset and .NET Collections etc. LINQ is a programming language which was first introduced in Visual Studio 2008 with .NET 3.5. C# and VB both support LINQ Syntax and in this tutorial, we will learn how to write LINQ query for accessing and managing data.
Why we need LINQ?
This is the very basic question which comes in our mind that Why we need LINQ if we have SQL for querying relational database and XQuery for querying XML? When each data source has their specific query language then why need to develop an extra programming language?
A new technology is getting developed continuously and the developer has had to learn a different language each time. So, it was the demand of the time that there must be a unique and common query language that works with all types of data source. LINQ fulfill this requirement very well. Now, you don’t need to learn different types of query language to work with different types of data source. Just learn LINQ and work with any types of data source.
The advantage of Using LINQ
- Common Query - LINQ provides common query across various kinds of data source SQL Database, ADO.NET Dataset, XML Documents, .NET Collection etc.
- Working with Objects - In LINQ, you will always work with objects so you can use the same basic pattern of coding with different types of data source.
- Less Coding - LINQ reduces the number of coding lines. Dozens of lines of codes can be written in LINQ in a single line.
- Easy to Understand – LINQ is an easy to understand and more readable code. So other developers can easily understand LINQ query.
- Compile Time Safety – It checks codes on compile time so it reduces the risk of Runtime Error.
- IntelliSense Support - LINQ provides IntelliSense support that makes programming more confident.
Summary
In this tutorial, I tried to explain the basic overview and introduction to LINQ. Before starting LINQ Programming, it is necessary to learn basic of LINQ like what it is, use of LINQ etc. After reading this chapter, I hope now you will understand the LINQ more clearly. In the next chapter, you will learn the Syntax of LINQ and write your first LINQ program.