etc. . . .
Many more methods are described in the library documentation.
Properties
The following entries describe some of the properties of this type. Several more are
described in the library documentation.
Count
Returns the number of elements in the bag. This is sum of all multiplicities of
the unique elements in this bag.
CountUnique
Returns the number of unique elements in this bag. (Note: This is less than the
number of elements given by Count if some elements appear more than once in
the bag.)
304 Modeling Library Reference
IsEmpty
Returns true if the bag has no elements. Returns false otherwise.
Keys
Returns a set of all elements with multiplicity greater than zero.
etc. . . .
Several more properties are described in the library documentation.
Fields
EmptyBag
(Static field.) The bag of type T that contains no elements.
Remarks
For any value x, the multiplicity of x is the number of times x occurs in the bag, or
zero if x is not in the bag.
The data type is immutable; add/remove operations return a new bag.
Equality is structural. Two bags are equal if they contain the same elements with
the same multiplicities. Order does not affect equality.
A.2.7 Pair
Pair
Binary tuples with structural equality.
Syntax
public struct Pair : IAbstractValue, IComparable
Constructors
Pair(T, S)
Initializes a new instance of a pair with the given arguments.
Pages:
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393