LINQ :Querying in-memory collections/objects in ASP .NET
This article is about Querying in-memory collection/objects in ASP .NET(C#) Using LINQ. NOTE:"objects" in this article refers to any in-memory collection like array,list etc or class objects. LINQ (Language Integrated Query) introduced from .NET 3.5 provides very important programming features to developers. Using LINQ developer can perform query on in-memory objects data,just like we query in database like SQL Server. All developers may face scenario where they want to query in-memory objects like selecting data from DataTable according to specific criteria. This also avoids to write database query/stored procedures for each and every criteria if the data retrieved from database. We can write the same query in C# for in-memory objects thanks to LINQ. Query can be performed only on objects which implements IEnumerable<T>. Here is simple LINQ query: int [] marks = { 20 , 55 , 34 , 89 , 70 , 60 }; var over60 = from m in marks where m >= 60