Monday, August 3, 2015

Thoughts on LINQ

1.LINQ queries look similar to SQL queries, the syntax is not identical. In fact consider LINQ queries as unique statements, which just “happen to look” similar to SQL.

2.The LINQ API provides a consistent, symmetrical manner in which programmers can obtain and manipulate “data” (it can be DB ,XML ,collection, Generics.. etc.)

4.System.Array does not directly implement the IEnumerable<T> interface, it indirectly gains the required functionality of this type (as well as many other LINQ-centric members) via the static System.Linq.Enumerable class type.

5.Deferred Execution :LINQ query expressions is that they are not actually evaluated until you iterate over the sequence            

5.Immediate Execution :When you need to evaluate a LINQ expression from outside the confines of foreach logic, you are able to call any number of extension methods defined by the Enumerable type as ToArray<T>(),ToDictionary<TSource,TKey>(), and ToList<T>(). These methods will cause a LINQ query to execute at the exact moment you call them, to obtain a snapshot of the data

6.For Non generic collection, it is still possible to iterate over data using the generic Enumerable.OfType<T>() extension method.

7.Forms of LINQ :
var result = from matchingItem in container select matchingItem;

var result = from item in container where BooleanExpression select item;

No comments:

Post a Comment