Iesi.Collections

DictionarySet is an abstract class that supports the creation of new Set types where the underlying data store is an IDictionary instance.

You can use any object that implements the IDictionary interface to hold set data. You can define your own, or you can use one of the objects provided in the Framework. The type of IDictionary you choose will affect both the performance and the behavior of the Set using it.

To make a Set typed based on your own IDictionary, simply derive a new class with a constructor that takes no parameters. Some Set implmentations cannot be defined with a default constructor. If this is the case for your class, you will need to override Clone() as well.

It is also standard practice that at least one of your constructors takes an ICollection or an ISet as an argument.

A collection that contains no duplicate elements. This class models the mathematical Set abstraction, and is the base class for all other Set implementations. The order of elements in a set is dependant on (a)the data-structure implementation, and (b)the implementation of the various Set methods, and thus is not guaranteed.

None of the Set implementations in this library are guranteed to be thread-safe in any way unless wrapped in a SynchronizedSet.

The following table summarizes the binary operators that are supported by the Set class.

Operation Description Method Operator Union (OR) Element included in result if it exists in either A OR B. Union() | Intersection (AND) Element included in result if it exists in both A AND B. InterSect() & Exclusive Or (XOR) Element included in result if it exists in one, but not both, of A and B. ExclusiveOr() ^ Minus (n/a) Take all the elements in A. Now, if any of them exist in B, remove them. Note that unlike the other operators, A - B is not the same as B - A. Minus() -

A collection that contains no duplicate elements. This interface models the mathematical Set abstraction. The order of elements in a set is dependant on (a)the data-structure implementation, and (b)the implementation of the various Set methods, and thus is not guaranteed.

None of the Set implementations in this library are guranteed to be thread-safe in any way unless wrapped in a SynchronizedSet.

The following table summarizes the binary operators that are supported by the Set class.

Operation Description Method Union (OR) Element included in result if it exists in either A OR B. Union() Intersection (AND) Element included in result if it exists in both A AND B. InterSect() Exclusive Or (XOR) Element included in result if it exists in one, but not both, of A and B. ExclusiveOr() Minus (n/a) Take all the elements in A. Now, if any of them exist in B, remove them. Note that unlike the other operators, A - B is not the same as B - A. Minus()
Performs a "union" of the two sets, where all the elements in both sets are present. That is, the element is included if it is in either a or b. Neither this set nor the input set are modified during the operation. The return value is a Clone() of this set with the extra elements added in. A collection of elements. A new Set containing the union of this Set with the specified collection. Neither of the input objects is modified by the union. Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included if it exists in both sets. The Intersect() operation does not modify the input sets. It returns a Clone() of this set with the appropriate elements removed. A set of elements. The intersection of this set with a. Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of this Set containing the elements from the operation. A set of elements. A set containing the elements from this set with the elements in a removed. Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a Clone() of this set containing the elements from the exclusive-or operation. A set of elements. A set containing the result of a ^ b. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Returns if this set contains no elements.

A collection that contains no duplicate elements. This interface models the mathematical Set abstraction. The order of elements in a set is dependant on (a)the data-structure implementation, and (b)the implementation of the various Set methods, and thus is not guaranteed.

None of the Set implementations in this library are guranteed to be thread-safe in any way unless wrapped in a SynchronizedSet.

The following table summarizes the binary operators that are supported by the Set class.

Operation Description Method Union (OR) Element included in result if it exists in either A OR B. Union() Intersection (AND) Element included in result if it exists in both A AND B. InterSect() Exclusive Or (XOR) Element included in result if it exists in one, but not both, of A and B. ExclusiveOr() Minus (n/a) Take all the elements in A. Now, if any of them exist in B, remove them. Note that unlike the other operators, A - B is not the same as B - A. Minus()
Performs a "union" of the two sets, where all the elements in both sets are present. That is, the element is included if it is in either a or b. Neither this set nor the input set are modified during the operation. The return value is a Clone() of this set with the extra elements added in. A collection of elements. A new Set containing the union of this Set with the specified collection. Neither of the input objects is modified by the union. Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included if it exists in both sets. The Intersect() operation does not modify the input sets. It returns a Clone() of this set with the appropriate elements removed. A set of elements. The intersection of this set with a. Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of this Set containing the elements from the operation. A set of elements. A set containing the elements from this set with the elements in a removed. Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a Clone() of this set containing the elements from the exclusive-or operation. A set of elements. A set containing the result of a ^ b. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Removes all objects from the set. Returns if this set contains no elements. Performs a "union" of the two sets, where all the elements in both sets are present. That is, the element is included if it is in either a or b. Neither this set nor the input set are modified during the operation. The return value is a Clone() of this set with the extra elements added in. A collection of elements. A new Set containing the union of this Set with the specified collection. Neither of the input objects is modified by the union. Performs a "union" of two sets, where all the elements in both are present. That is, the element is included if it is in either a or b. The return value is a Clone() of one of the sets (a if it is not ) with elements of the other set added in. Neither of the input sets is modified by the operation. A set of elements. A set of elements. A set containing the union of the input sets. if both sets are . Performs a "union" of two sets, where all the elements in both are present. That is, the element is included if it is in either a or b. The return value is a Clone() of one of the sets (a if it is not ) with elements of the other set added in. Neither of the input sets is modified by the operation. A set of elements. A set of elements. A set containing the union of the input sets. if both sets are . Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included if it exists in both sets. The Intersect() operation does not modify the input sets. It returns a Clone() of this set with the appropriate elements removed. A set of elements. The intersection of this set with a. Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included only if it exists in both a and b. Neither input object is modified by the operation. The result object is a Clone() of one of the input objects (a if it is not ) containing the elements from the intersect operation. A set of elements. A set of elements. The intersection of the two input sets. if both sets are . Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included only if it exists in both a and b. Neither input object is modified by the operation. The result object is a Clone() of one of the input objects (a if it is not ) containing the elements from the intersect operation. A set of elements. A set of elements. The intersection of the two input sets. if both sets are . Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of this Set containing the elements from the operation. A set of elements. A set containing the elements from this set with the elements in a removed. Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of set a containing the elements from the operation. A set of elements. A set of elements. A set containing A - B elements. if a is . Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of set a containing the elements from the operation. A set of elements. A set of elements. A set containing A - B elements. if a is . Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a Clone() of this set containing the elements from the exclusive-or operation. A set of elements. A set containing the result of a ^ b. Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a Clone() of one of the sets (a if it is not ) containing the elements from the exclusive-or operation. A set of elements. A set of elements. A set containing the result of a ^ b. if both sets are . Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a Clone() of one of the sets (a if it is not ) containing the elements from the exclusive-or operation. A set of elements. A set of elements. A set containing the result of a ^ b. if both sets are . Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes all objects from the set. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Returns a clone of the Set instance. This will work for derived Set classes if the derived class implements a constructor that takes no arguments. A clone of this object. Copies the elements in the Set to an array. The type of array needs to be compatible with the objects in the Set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Gets an enumerator for the elements in the Set. An IEnumerator over the elements in the Set. Performs CopyTo when called trhough non-generic ISet (ICollection) interface Performs Union when called trhough non-generic ISet interface Performs Minus when called trhough non-generic ISet interface Performs Intersect when called trhough non-generic ISet interface Performs ExclusiveOr when called trhough non-generic ISet interface Returns if this set contains no elements. The number of elements currently contained in this collection. Returns if the Set is synchronized across threads. Note that enumeration is inherently not thread-safe. Use the SyncRoot to lock the object during enumeration. An object that can be used to synchronize this collection to make it thread-safe. When implementing this, if your object uses a base object, like an IDictionary, or anything that has a SyncRoot, return that object instead of "this". Indicates whether the given instance is read-only or not if the ISet is read-only; otherwise, . In the default implementation of Set, this property always returns false. Provides the storage for elements in the Set, stored as the key-set of the IDictionary object. Set this object in the constructor if you create your own Set class. Adds the specified element to this set if it is not already present. The to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes all objects from the set. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Copies the elements in the Set to an array of T. The type of array needs to be compatible with the objects in the Set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Gets an enumerator for the elements in the Set. An IEnumerator over the elements in the Set. Copies the elements in the Set to an array. The type of array needs to be compatible with the objects in the Set, obviously. Needed for non-generic ISet methods implementation An array that will be the target of the copy operation. The zero-based index where copying will start. The placeholder object used as the value for the IDictionary instance. There is a single instance of this object globally, used for all Sets. Returns if this set contains no elements. The number of elements contained in this collection. None of the objects based on DictionarySet are synchronized. Use the SyncRoot property instead. Returns an object that can be used to synchronize the Set between threads. Indicates wether the Set is read-only or not Implements a Set based on a Dictionary (which is equivalent of non-genric HashTable) This will give the best lookup, add, and remove performance for very large data-sets, but iteration will occur in no particular order. Creates a new set instance based on a Dictinary. Creates a new set instance based on a Dictinary and initializes it based on a collection of elements. A collection of elements that defines the initial set contents.

Implements an immutable (read-only) Set wrapper.

Although this is advertised as immutable, it really isn't. Anyone with access to the basisSet can still change the data-set. So GetHashCode() is not implemented for this Set, as is the case for all Set implementations in this library. This design decision was based on the efficiency of not having to Clone() the basisSet every time you wrap a mutable Set.

Constructs an immutable (read-only) Set wrapper. The Set that is wrapped. Adds the specified element to this set if it is not already present. The object to add to the set. nothing is always thrown Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. nothing is always thrown Removes all objects from the set. is always thrown Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. nothing is always thrown Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. nothing is always thrown Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. nothing is always thrown Copies the elements in the Set to an array of T. The type of array needs to be compatible with the objects in the Set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Gets an enumerator for the elements in the Set. An IEnumerator over the elements in the Set. Returns a clone of the Set instance. A clone of this object. Performs a "union" of the two sets, where all the elements in both sets are present. That is, the element is included if it is in either a or b. Neither this set nor the input set are modified during the operation. The return value is a Clone() of this set with the extra elements added in. A collection of elements. A new Set containing the union of this Set with the specified collection. Neither of the input objects is modified by the union. Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included if it exists in both sets. The Intersect() operation does not modify the input sets. It returns a Clone() of this set with the appropriate elements removed. A set of elements. The intersection of this set with a. Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of this Set containing the elements from the operation. A set of elements. A set containing the elements from this set with the elements in a removed. Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a Clone() of this set containing the elements from the exclusive-or operation. A set of elements. A set containing the result of a ^ b. Performs CopyTo when called trhough non-generic ISet (ICollection) interface Performs Union when called trhough non-generic ISet interface Performs Minus when called trhough non-generic ISet interface Performs Intersect when called trhough non-generic ISet interface Performs ExclusiveOr when called trhough non-generic ISet interface Returns if this set contains no elements. The number of elements contained in this collection. Returns an object that can be used to synchronize use of the Set across threads. Returns an object that can be used to synchronize the Set between threads. Indicates that the given instance is read-only Implements an ordered Set based on a dictionary. Initializes a new instance of the class. Initializes a new instance of the class. A collection of elements that defines the initial set contents. Implements a Set based on a sorted tree. This gives good performance for operations on very large data-sets, though not as good - asymptotically - as a HashedSet. However, iteration occurs in order. Elements that you put into this type of collection must implement IComparable, and they must actually be comparable. You can't mix string and int values, for example. Creates a new set instance based on a sorted tree. Creates a new set instance based on a sorted tree. The to use for sorting. Creates a new set instance based on a sorted tree and initializes it based on a collection of elements. A collection of elements that defines the initial set contents. Creates a new set instance based on a sorted tree and initializes it based on a collection of elements. A collection of elements that defines the initial set contents. Creates a new set instance based on a sorted tree and initializes it based on a collection of elements. A collection of elements that defines the initial set contents. The to use for sorting.

Implements a thread-safe Set wrapper. The implementation is extremely conservative, serializing critical sections to prevent possible deadlocks, and locking on everything. The one exception is for enumeration, which is inherently not thread-safe. For this, you have to lock the SyncRoot object for the duration of the enumeration.

Constructs a thread-safe Set wrapper. The Set object that this object will wrap. Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes all objects from the set. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Copies the elements in the Set to an array. The type of array needs to be compatible with the objects in the Set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Enumeration is, by definition, not thread-safe. Use a lock on the SyncRoot to synchronize the entire enumeration process. Returns a clone of the Set instance. A clone of this object. Performs CopyTo when called trhough non-generic ISet (ICollection) interface Returns if this set contains no elements. The number of elements contained in this collection. Returns , indicating that this object is thread-safe. The exception to this is enumeration, which is inherently not thread-safe. Use the SyncRoot object to lock this object for the entire duration of the enumeration. Returns an object that can be used to synchronize the Set between threads. Indicates whether given instace is read-only or not

DictionarySet is an abstract class that supports the creation of new Set types where the underlying data store is an IDictionary instance.

You can use any object that implements the IDictionary interface to hold set data. You can define your own, or you can use one of the objects provided in the Framework. The type of IDictionary you choose will affect both the performance and the behavior of the Set using it.

To make a Set typed based on your own IDictionary, simply derive a new class with a constructor that takes no parameters. Some Set implmentations cannot be defined with a default constructor. If this is the case for your class, you will need to override Clone() as well.

It is also standard practice that at least one of your constructors takes an ICollection or an ISet as an argument.

A collection that contains no duplicate elements. This class models the mathematical set abstraction, and is the base class for all other set implementations. The order of elements in a set is dependant on (a) the data-structure implementation, and (b) the implementation of the various methods, and thus is not guaranteed. None of the implementations in this library are guranteed to be thread-safe in any way unless wrapped in a . The following table summarizes the binary operators that are supported by the type. Operation Description Method Operator Union (OR) Element included in result if it exists in either A OR B. Union() | Intersection (AND) Element included in result if it exists in both A AND B. InterSect() & Exclusive Or (XOR) Element included in result if it exists in one, but not both, of A and B. ExclusiveOr() ^ Minus (n/a) Take all the elements in A. Now, if any of them exist in B, remove them. Note that unlike the other operators, A - B is not the same as B - A. Minus() - Performs a "union" of the two sets, where all the elements in both sets are present. That is, the element is included if it is in either a or b. Neither this set nor the input set are modified during the operation. The return value is a clone of this set with the extra elements added in. A collection of elements. A new instance containing the union of this instance with the specified collection. Neither of the input objects is modified by the union. Performs a "union" of two sets, where all the elements in both are present. That is, the element is included if it is in either a or b. The return value is a clone of one of the sets (a if it is not ) with elements of the other set added in. Neither of the input sets is modified by the operation. A set of elements. A set of elements. A set containing the union of the input sets. if both sets are . Performs a "union" of two sets, where all the elements in both are present. That is, the element is included if it is in either a or b. The return value is a clone of one of the sets (a if it is not ) with elements of the other set added in. Neither of the input sets is modified by the operation. A set of elements. A set of elements. A set containing the union of the input sets. if both sets are . Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included if it exists in both sets. The Intersect() operation does not modify the input sets. It returns a Clone() of this set with the appropriate elements removed. A set of elements. The intersection of this set with a. Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included only if it exists in both a and b. Neither input object is modified by the operation. The result object is a Clone() of one of the input objects (a if it is not ) containing the elements from the intersect operation. A set of elements. A set of elements. The intersection of the two input sets. if both sets are . Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included only if it exists in both a and b. Neither input object is modified by the operation. The result object is a Clone() of one of the input objects (a if it is not ) containing the elements from the intersect operation. A set of elements. A set of elements. The intersection of the two input sets. if both sets are . Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of this Set containing the elements from the operation. A set of elements. A set containing the elements from this set with the elements in a removed. Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of set a containing the elements from the operation. A set of elements. A set of elements. A set containing A - B elements. if a is . Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of set a containing the elements from the operation. A set of elements. A set of elements. A set containing A - B elements. if a is . Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a clone of this set containing the elements from the exclusive-or operation. A set of elements. A set containing the result of a ^ b. Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a clone of one of the sets (a if it is not ) containing the elements from the exclusive-or operation. A set of elements. A set of elements. A set containing the result of a ^ b. if both sets are . Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a clone of one of the sets (a if it is not ) containing the elements from the exclusive-or operation. A set of elements. A set of elements. A set containing the result of a ^ b. if both sets are . Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes all objects from the set. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Returns a clone of the set instance. This will work for derived set classes if the derived class implements a constructor that takes no arguments. A clone of this object. Copies the elements in the set to an array. The type of array needs to be compatible with the objects in the set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Returns an enumerator that iterates through the set. An object that can be used to iterate through the set. Returns if this set contains no elements. The number of elements currently contained in this collection. Returns if the set is synchronized across threads. Note that enumeration is inherently not thread-safe. Use the to lock the object during enumeration. An object that can be used to synchronize this collection to make it thread-safe. When implementing this, if your object uses a base object, like an , or anything that has a , return that object instead of . Provides the storage for elements in the Set, stored as the key-set of the IDictionary object. Set this object in the constructor if you create your own Set class. Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes all objects from the set. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Copies the elements in the Set to an array. The type of array needs to be compatible with the objects in the Set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Gets an enumerator for the elements in the Set. An IEnumerator over the elements in the Set. The placeholder object used as the value for the IDictionary instance. There is a single instance of this object globally, used for all Sets. Returns if this set contains no elements. The number of elements contained in this collection. None of the objects based on DictionarySet are synchronized. Use the SyncRoot property instead. Returns an object that can be used to synchronize the Set between threads. Implements a Set based on a hash table. This will give the best lookup, add, and remove performance for very large data-sets, but iteration will occur in no particular order. Creates a new set instance based on a hash table. Creates a new set instance based on a hash table and initializes it based on a collection of elements. A collection of elements that defines the initial set contents. Implements a Set that automatically changes from a list to a hash table when the size reaches a certain threshold. This is good if you are unsure about whether you data-set will be tiny or huge. Because this uses a dual implementation, iteration order is not guaranteed! Creates a new set instance based on either a list or a hash table, depending on which will be more efficient based on the data-set size. Creates a new set instance based on either a list or a hash table, depending on which will be more efficient based on the data-set size, and initializes it based on a collection of elements. A collection of elements that defines the initial set contents.

Implements an immutable (read-only) Set wrapper.

Although this is advertised as immutable, it really isn't. Anyone with access to the basisSet can still change the data-set. So GetHashCode() is not implemented for this Set, as is the case for all Set implementations in this library. This design decision was based on the efficiency of not having to Clone() the basisSet every time you wrap a mutable Set.

Constructs an immutable (read-only) Set wrapper. The Set that is wrapped. Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes all objects from the set. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Copies the elements in the Set to an array. The type of array needs to be compatible with the objects in the Set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Gets an enumerator for the elements in the Set. An IEnumerator over the elements in the Set. Returns a clone of the Set instance. A clone of this object. Performs a "union" of the two sets, where all the elements in both sets are present. That is, the element is included if it is in either a or b. Neither this set nor the input set are modified during the operation. The return value is a Clone() of this set with the extra elements added in. A collection of elements. A new Set containing the union of this Set with the specified collection. Neither of the input objects is modified by the union. Performs an "intersection" of the two sets, where only the elements that are present in both sets remain. That is, the element is included if it exists in both sets. The Intersect() operation does not modify the input sets. It returns a Clone() of this set with the appropriate elements removed. A set of elements. The intersection of this set with a. Performs a "minus" of set b from set a. This returns a set of all the elements in set a, removing the elements that are also in set b. The original sets are not modified during this operation. The result set is a Clone() of this Set containing the elements from the operation. A set of elements. A set containing the elements from this set with the elements in a removed. Performs an "exclusive-or" of the two sets, keeping only the elements that are in one of the sets, but not in both. The original sets are not modified during this operation. The result set is a Clone() of this set containing the elements from the exclusive-or operation. A set of elements. A set containing the result of a ^ b. Returns if this set contains no elements. The number of elements contained in this collection. Returns an object that can be used to synchronize use of the Set across threads. Returns an object that can be used to synchronize the Set between threads. Implements a Set based on a list. Performance is much better for very small lists than either HashedSet or SortedSet. However, performance degrades rapidly as the data-set gets bigger. Use a HybridSet instead if you are not sure your data-set will always remain very small. Iteration produces elements in the order they were added. However, element order is not guaranteed to be maintained by the various Set mathematical operators. Creates a new set instance based on a list. Creates a new set instance based on a list and initializes it based on a collection of elements. A collection of elements that defines the initial set contents. Implements a set based on a sorted tree. This gives good performance for operations on very large data-sets, though not as good - asymptotically - as a . However, iteration occurs in order. Elements that you put into this type of collection must implement , and they must actually be comparable. You can't mix and values, for example. Creates a new set instance based on a sorted tree. Creates a new set instance based on a sorted tree. The to use for sorting. Creates a new set instance based on a sorted tree and initializes it based on a collection of elements. A collection of elements that defines the initial set contents. Creates a new set instance based on a sorted tree and initializes it based on a collection of elements. A collection of elements that defines the initial set contents. The to use for sorting. Implements a thread-safe wrapper. The implementation is extremely conservative, serializing critical sections to prevent possible deadlocks, and locking on everything. The one exception is for enumeration, which is inherently not thread-safe. For this, you have to the object for the duration of the enumeration. Constructs a thread-safe wrapper. The object that this object will wrap. Adds the specified element to this set if it is not already present. The object to add to the set. is the object was added, if it was already present. Adds all the elements in the specified collection to the set if they are not already present. A collection of objects to add to the set. is the set changed as a result of this operation, if not. Removes all objects from the set. Returns if this set contains the specified element. The element to look for. if this set contains the specified element, otherwise. Returns if the set contains all the elements in the specified collection. A collection of objects. if the set contains all the elements in the specified collection, otherwise. Removes the specified element from the set. The element to be removed. if the set contained the specified element, otherwise. Remove all the specified elements from this set, if they exist in this set. A collection of elements to remove. if the set was modified as a result of this operation. Retains only the elements in this set that are contained in the specified collection. Collection that defines the set of elements to be retained. if this set changed as a result of this operation. Copies the elements in the set to an array. The type of array needs to be compatible with the objects in the set, obviously. An array that will be the target of the copy operation. The zero-based index where copying will start. Returns an enumerator that iterates through the set. An object that can be used to iterate through the set. Enumeration is, by definition, not thread-safe. Use a on the to synchronize the entire enumeration process. Returns a clone of this instance. A clone of this object. Returns if this set contains no elements. The number of elements contained in this collection. Returns , indicating that this object is thread-safe. The exception to this is enumeration, which is inherently not thread-safe. Use the object to lock this object for the entire duration of the enumeration. Returns an object that can be used to synchronize the set between threads.