What is LINQ?
LINQ (Language Integrated Query) is a useful query language introduced with C# 3.0 by Microsoft, which allows us to query different data sources.
LINQ is an acronym for Language Integrated Query and provides a query syntax for querying different types of data sources including collections, ADO.NET DataSet, XML, SQL Server, Entity Framework and other databases. The following visual representation will help to understand it better.

There are two different syntaxes in LINQ:
- Query Syntax (Query syntax) -> starts with “from”.
- Method Syntax (Method syntax)
If we have previously written SQL commands, Query Syntax method will not be unfamiliar to us. Let’s examine both syntaxes with a small example.
// Data Source (This data can be provided from anywhere as mentioned above.)
int[] numbers = new int[] { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
//QUERY SYNTAX
var smallNums = from num in numbers
where num < 5
select num;
//METHOD SYNTAX (My favorite🙂)
var smallNums2 = numbers.Where(x => x < 5);
// Using the written query
foreach (int numin smallNums)
{
Console.WriteLine(num);
}
Now that we have been introduced to LINQ, in order to fully understand its usage practices, we can download the lessons on GitHub and read them line by line. This link where you can download the lessons with a preview.

See you next article…