SelectMany Operator:CodeThinked: The Linq SelectMany Operator:QUOTE
The Linq SelectMany Operator
Posted on 5/8/2008 4:20:33 PM by Justin Etheredge
Most of you by now are familiar with LINQ, Microsoft's foray into crossing the code/data impedance mismatch. Most of what we see in Linq translates directly into our knowledge of SQL, since most LINQ queries use very similar semantics to SQL queries. There are certain operators though that don't look familiar because they either weren't present in our SQL lexicon or they were represented in a fundamentally different way. A little bit back I posted about one of these operators, the "let" operator, and how to use it effectively. I later followed it up with a post that dug a little bit deeper into the "let" operator so that you could get a peek at what was going on behind the scenes.
http://www.codethinked.com/post/2008/05/Th...y-operator.aspxZeeshan Hirani: Select Many Operator Part 1QUOTE
Select Many Operator is part of the projection query operator supported by linq. SelectMany operator is mainly used for flattening out the hierarchy of collections into one single collection of objects. It merges each item into a single sequence that gets returned by the query results.
Here is the prototype for SelectMany operator
public static IEnumerable<S> SelectMany<T, S>(
this IEnumerable<T> source,
Func<T, IEnumerable<S>> selector);
http://weblogs.asp.net/zeeshanhirani/archi...tor-part-1.aspx