blogs

miércoles, 16 de septiembre de 2015

Linq ||

I explained about LINQ in  previous post. Review this post http://marisolca.blogspot.com/2015/07/linq.html

Standard Mechanisms to apply LINQ in an arrays and generic collections(LINQ to Objects),at least there are others three technologies:
LINQ to XML:This execute integrated query on documents XML
LINQ to DataSets: This execute queries to LINQ style  against sets of typed or untyped data .
LINQ to SQL:to do possible the queries of  related database by programming language resources.

The LINQ architecture can be described to the following graphic



Query expressions: It is main mechanism by LINQ purchase life ,
It is a expression that respond to a new syntax that has been added to C# 3.0 and this can act  on any object that implements generic interface IEnumerable<T> 
For example

These are our classes








Add test methods


Using Lambda functions and extension methods

In  previous posts I explained about Lambda expression, and extension  methods, 
IEnumerable interface.
Review these post.


Using Lambda Functions




The test method shows people that satisfy the condition.  




Using Extension Methods





We can make the other way, the result is the same


The result of the execution of the two methods






In this case we have only added extension method to Where(), we also can add to Select 






 

No hay comentarios:

Publicar un comentario