Method or Property
Description
Comparer
Returns the
IEqualityComparer<T>
currently associated
with this Bag.
Contains()
Determines if the Bag contains the specified item. If a match
is found, the method returns
true
.
Count
Property that returns the number of items currently in the
Bag.
Difference()
Computes the difference between the contents of this Bag
and the Bag that is supplied. This difference is determined
based on the difference in the number of instances of each
item in this Bag and the passed-in Bag. A Bag containing the
computed difference is returned.
DifferenceWith()
Computes the difference between the contents of this Bag
and the Bag that is supplied. The current Bag is modified in
place to represent the difference between the current Bag
and the supplied Bag.
DistinctItems()
Retrieves an
IEnumerable<T>
collection that contains all
the unique items that are currently in this Bag.
GetEnumerator()
Gets an
IEnumerator<T>
representation of the items in the
Bag.
GetRepresentativeItem()
Retrieves the representative item that matches the specified
item type. This method also returns the total number of
items in the Bag that match the supplied type.
Intersection()
Computes the intersection between this Bag and another
Bag and returns a new Bag that contains the items in this
intersection.
IntersectionWith()
Computes the intersection between this Bag and another
Bag and modifies this Bag to contain the items that are in
this intersection.
IsEqualTo()
Determines if two Bags are considered equal.
IsDisjointFrom()
Determines if one collection is considered disjoint from
another.
IsProperSubsetOf()
Determines if the supplied Bag is a valid subset of this Bag.
If all the items in the passed-in Bag are in this Bag, this
method returns
true
. To be a "proper" subset, this Bag
must have fewer items than the supplied Bag.
IsProperSupersetOf()
Determines if the supplied Bag is a valid superset of this
Bag. If all the items in the supplied Bag are also in this Bag,
this method returns
true
. To be a "proper" superset, this
Bag must have more items than the supplied Bag.
322
Chapter 14
17_559885 ch14.qxd 9/8/05 11:07 PM Page 322