SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 134 | Next

Scott Klein

"Professional LINQ"

In other words,
it is ??????the elements of sequence A less the elements of sequence B.??™??™
int[] numbers1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} ;
int[] numbers2 = { 2, 4, 6, 8, 10} ;
IEnumerable shared = numbers1.Except(numbers2);
foreach (int num in shared)
listBox1.Items.Add(num);
The output is
1
3
5
7
9
Generation Operators
Generation operators create new sequences from the values of existing sequences. The element generation
operators are discussed in this section.
Empty
The Empty operator returns an empty collection that has a specified type. In the following example, three
lists of names are defined and added to an array list. The Aggregate operator is applied to gather values
from the array list if the array contains more than two elements. The Empty operator is then used to
provide an empty collection if the criteria is not met (that is, if no arrays have more than two elements).
string[] name1 = { "Scott", "Steve"} ;
string[] name2 = { "Joe", "John", "Jim", "Josh", "Joyce"} ;
string[] name3 = { "Dave", "Dinesh", "Doug", "Doyle"} ;
List names = new List { name1, name2, name3} ;
IEnumerable namelist = names.


Pages:
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6