What is LINQ and Why Do We Need it?

What is LINQ and Why Do We Need it?

What is LINQ

What is LINQ. LINQ stands for Langauge Integrated Query. It is a query language to retrieve data from data sources just like SQL. The LINQ was released by Microsoft with .Net 3.5. The language is designed by Microsoft to work in a C# and .net environment. This language was designed to access data from data sources such as objects, data sets, XML, and SQL Server etcetera.

Why LINQ?

All types of products in the programming industry like web-based applications, software, websites etcetera, they all use some type of database where they put some very information about application data or user of the product.

At the time when LINQ was developed by Microsoft, retrieving data from data sources was a complicated task. One database query language called SQL was very famous and was doing good in the programming industry. Microsoft was impressed with SQL design but they wanted to develop their own database query language because they had recognized the need for a new language to fulfill a gap. The idea of LINQ was great because SQL was working with only SQL servers and Microsoft wanted a language that could retrieve data from multiple data sources starting from an object, data sets, XML to other big data sources like Oracle, SQL Server.

Microsoft-and-LINQ

Many data management technologies were available and they had their own query language to access data from their database. This was complicated. It was an extra burden on developers to learn a new database query language with each data management software.

LINQ is designed to query all databases with a unified query language. It was a huge relief for developers. They were able to query all types of the database without learning a new database query language.

The Microsoft database query language was also designed to solve very complicated tasks like querying arrays and APIs. Earlier if you had an array with so many elements and you want to take out some elements based on some condition, it was an intricate task using the normal C# language alone.

First, you need to know how many elements are in that array by using a loop. Then you need to use another sub-loop to set your condition. But it was very easy to do with LINQ.

How to use the Langauge Integrated query is a topic for another article. I will be writing more articles about the use and syntaxes so stay tuned.

Till then take care guys in this Covid times. Stay Safe, Stay healthy.

Have a Good One!

Read more