LINQ

This is a name that incorporates a wide range of general purpose querying that can be down.
There can often be a lot of complexity around the actual data.
The common sources are relational databses and XML.
LINQ provides a standardised means to query information from many different data sources.
Rather than try and add specific (relational or XML) features to help with this complexity the approach has been more general.


Language integrated query allows a single general purpose declarative query facility to be applied to not just relational or XML based data but in-memory data as well.
LINQ defines a set of general purpose standard query operators that allow the traversal, filter and projection of information to be expressed in a direct and declarative way.
These standard query operators can be found in the System.Linq namespace.
LINQ can be divided into the following categories:
Collections - Refers to extension methods that are available for all the classes that implement the IEnumerable or IEnumerable<T> interfaces.
LINQ to XML - Refers to the use of the standard query operators as well as tree specific operators.



You can use LINQ to query any enumerable collections such as List<T>, Array or Dictionary<Tkey, TValue>


FindAll - returns a list of the actual object
Where -
Select -
First -
Last -
Reverse -


FindAll Method

Retrieves all the elements that match the conditions defined by the specific predicate

System.Collections.Generic.List<myobject> mylist; 
mylist = new System.Collections.Generic.List<myobject>
mylist.Add(object1)
mylist.Add(object2)
mylist.FindAll(delegate(myobject obj) { return obj.Property == true; } );

var mylist2 = from obj in mylist
           where obj.Property == true
           select obj



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext