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 219 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"

Intersection is the set of elements
shared by the two sets. Difference is the set of elements from the first set that are
not found in the second set.
Set s1 = new Set(1, 2, 3, 4, 5, 6);
Set s2 = new Set(1, 3, 5, 7, 9, 11);
Set s3 = s1.Union(s2);
Set s4 = s1.Intersect(s2);
Set s5 = s1.Difference(s2);
Assert.AreEqual(s3, new Set(1, 2, 3, 4, 5, 6, 7, 9, 11));
Assert.AreEqual(s4, new Set(1, 3, 5));
Assert.AreEqual(s5, new Set(2, 4, 6));
You can write union as +, intersection as *, and difference as -.
Set s1 = new Set(1, 2, 3, 4, 5, 6);
Set s2 = new Set(1, 3, 5, 7, 9, 11);
Set s3 = s1 + s2;
Set s4 = s1 * s2;
Set s5 = s1 - s2;
Assert.AreEqual(s3, new Set(11, 3, 2, 9, 6, 5, 7, 4, 1));
Assert.AreEqual(s4, new Set(3, 1, 5));
Assert.AreEqual(s5, new Set(6, 4, 2));
10.3.2 Maps
Maps associate unique keys with values. This is similar to the .NET Dictionary type,
except that a map is an immutable value. Operations to add and remove elements
result in new maps instead of making changes to the map given as the argument.
Another difference between maps and the .NET dictionary type is structural
equality. Two maps of the same type are equal if they contain the same key/value
pairs. Dictionaries in .NET use reference equality instead of structural equality.


Pages:
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6