An Extensive Examination of LINQ: Extending LINQ - Adding Query Operators

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
As discussed in earlier installments of this article series - most notably in http://www.4guysfromrolla.com/articles/021109-1.aspx An Introduction to LINQ
and http://www.4guysfromrolla.com/articles/040109-1.aspx The Standard Query Operators - one of LINQs primary components is its set of <i>standard
query operators</i>. A query operator is a method that operates on a sequence of data and performs some task based on that data, are implemented as
http://www.4guysfromrolla.com/articles/120507-1.aspx extension methods on types that implement
the http://msdn.microsoft.com/en-us/library/9eekhta0.aspx
Code:
IEnumerable<T>
interface . Some of the standard query operators that weve
explored throughout the articles in this series include:
Code:
Count
,
Code:
Average
,
Code:
First
,
Code:
Skip
,
Code:
Take
,
Code:
Where
,
and
Code:
OrderBy
, among others.

While these standard query operators provide a great detail of functionality, there may be situations where they fall short. The good news is that its quite easy to create
your own query operators. Underneath the covers query operators are just methods that extend types that implement
Code:
IEnumerable<T>
and iterate over the
sequence performing some task, such as computing the total number of items in the sequence, computing the average, filtering the results, or ordering them. This article examines
how to extend LINQs functionality by creating your own extension methods. Read on to learn more!

http://www.4guysfromrolla.com/articles/070710-1.aspx" class="readmore Read More >

View the full article
 
Back
Top