LINQ (Language Integrated Query, pronounced "link") is a Microsoft .NET Framework component that adds native data querying.)
Linq is the Microsoft's first attempt to integrate queries into language. We know, it is really easy to find data from sql objects simply writing a query while its somewhat hectic when we want to do the same thing in a DataTable or Lists. Generally we will have to loop through every elements to find the exact match, if there is some aggregation we need to aggregate the values etc. Linq provides an easy way to write queries that can run with the in memory objects.
Linq provides an easy way to write queries that can run with the in memory objects.
Example: (from item in itemlist where item.value = somevalue select item).toList
Types of LINQ
- LINQ (Linq to Objects)
Linq To Objects - examine System.Linq.Enumerable for query methods. These target IEnumerable
, allowing any typed loopable collection to be queried in a type-safe manner. These queries rely on compiled .Net methods, not Expressions. - DLINQ (Linq to SQL)
- XLINQ (Linq to XML)
Linq comes with 3 basic types (Provided there are lots of more types of LINQ on different type of objects :
LINQ Operators
-
Restriction Operator
Where -
Projection Operator
Select -
Partition Operators
Take, Skip, TakeWhile, SkipWhile -
Ordering Operators
OrderBy, OrderByDescending, ThenBy, ThenByDescending, Reverse -
Grouping Operators
GroupBy -
Set Operators
Distinct, Union, Intersect, Except -
Conversion Operators
ToArray, ToList, ToDictionary, OfType -
Element Operators
First, FirstOrDefault, ElementAt -
Generation Operators
Range, Repeat -
Quantifiers
Any, All -
Aggregate Operators
Count, Sum, Min, Max, Average, Aggregate -
Miscellaneous Operators
Concat, EquallAll - Custom Sequence Operators
Combine -
Query Execution
Deferred, Immediate, Query Reuse -
Join Operators
Cross Join, Group Join, Cross Join with Group Join, Left Ounter join
http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
LINQ to Objects
http://www.codeproject.com/KB/dotnet/LINQ.aspx
http://www.codeproject.com/KB/cs/InsideAnonymousMethods.aspx
What is Language-Integrated Query - LINQ?
LINQ Query Expressions
No comments:
Post a Comment