LINQ (Language Integrated Query) is a standard query syntax for retrieving data from many sources and formats in C# VB.NET, to remove the gap between programming languages and databases, also offers a single querying interface for many data sources.
The results of queries are returned as objects. It allows you to work with the result set in an object-oriented manner without having to worry about converting multiple formats of results into objects.
SQL, for instance, is a Structured Query Language (SQL) that is used to save and retrieve data.
Example:
string[] names = {“Monika”, “Seema”, “Mansi”, “Anu” }; // Data source
var linqQuery = from name in names where name.Contains(‘a’) select name; // LINQ Query
foreach(var name in linqQuery) // Query execution
{
Console.Write(name + ” “);
}
Output:
Monika Seema Mansi
Why Linq?
The following are the main flavours:
LINQ to Objects – Allows in-memory objects such as arrays, lists, generic lists, and any type of collection to be queried.
LINQ to XML – Allows you to query an XML document by first converting it to XElement objects and then querying it with the local execution engine.
LINQ to SQL – It’s a query language that’s designed to operate with SQL databases etc.
It is used in a variety of applications for diverse purposes, but one real-world example: LINQ was used to create LINQ for Twitter. LINQ to Twitter is an open-source Provider for the microblogging site Twitter. It contains method calls for modifications via the Twitter API and uses normal syntax for queries.
Because it is type safe, query errors are type checked at compile time rather than at runtime, as was previously the case. In other words, it speeds up the debugging process.
Knowledge of .NET is quite rewarding in the IT industry. If you have got some skills in the .NET framework then a .NET certification from StudySection can prove to be a good attachment with your resume. You can go for a foundation level certificate as well as an advanced level certificate in the .NET framework.