Both select () and selectmany () generate one or more result values based on the source values.
Select () generates a result value for each source value. Therefore, the overall result is a set with the same number of elements as the source set. In contrast, selectaggregate () generates a single overall result that contains a series subset from each source value. The conversion function passed as a parameter to selectcenters () must return a sequence of enumerated values for each source value. Then, select () concatenates these enumerated sequences to create a large sequence.
String [] Text = {"Albert was here ",
"Burke slept late ",
"Connor is happy "};
VaR tokens = text. Select (S => S. Split (''));
Foreach (string [] Line in tokens)
Foreach (string token in line)
Console. Write ("{0}.", token );
String [] Text = {"Albert was here ",
"Burke slept late ",
"Connor is happy "};
VaR tokens = text. selectiterator (S => S. Split (''));
Foreach (string token in tokens)
Console. Write ("{0}.", token );
The following two illustrations demonstrate the conceptual differences between the operations of the two methods. In each case, assume that the selector (conversion) function selects an array composed of flower data from each source value.
DescriptionSelect ()Returns a set with the same number of elements as the source set.
DescriptionSelectmany ()How to concatenate the intermediate array sequence into a final result value, which contains each value in each intermediate array.
Msdn: http://msdn.microsoft.com/zh-cn/library/bb546168.aspx#Mtps_DropDownFilterText