LINQ:
Language Intergrated Query, one of the best feature of .Net 3.5. This converts the whole database into simple object and properties. it comprises a series of operators , which are used to query, filter and prohect data into the arrays, relational dbs, xml and enumerable classes. And everything need to be convert to object in order for LINQ to query it
This is how we can implement LINQ
{
string[] names = { "Ahh", "Brtert", "Cgfgdfgb",
"Dttt", "Efgfdg", "Fdfgdfg",
"Gdfgdfgdfg", "Hfgggg" };
IEnumerable<string> query = from s in names
where s.Length == 5
orderby s
select s.ToUpper();
foreach (string item in query)
Console.WriteLine(item);
}
this will display the name where length is equal to 5. Query writing in LINQ is totally opposite to sql as in sql we start from 'select' but in linq we start from 'From' .
You can use LINQ pad as tool to run linqs queries. |