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.

The following tables list the members exposed by the ListSet type.

Public Methods

  NameDescription
Add
Adds the specified element to this set if it is not already present.
(Inherited from DictionarySet.)
AddAll
Adds all the elements in the specified collection to the set if they are not already present.
(Inherited from DictionarySet.)
Clear
Removes all objects from the set.
(Inherited from DictionarySet.)
Clone
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.
(Inherited from Set.)
Contains
Returns trueTruetrue if this set contains the specified element.
(Inherited from DictionarySet.)
ContainsAll
Returns trueTruetrue if the set contains all the elements in the specified collection.
(Inherited from DictionarySet.)
CopyTo
Copies the elements in the Set to an array. The type of array needs to be compatible with the objects in the Set, obviously.
(Inherited from DictionarySet.)
GetEnumerator
Gets an enumerator for the elements in the Set.
(Inherited from DictionarySet.)
Remove
Removes the specified element from the set.
(Inherited from DictionarySet.)
RemoveAll
Remove all the specified elements from this set, if they exist in this set.
(Inherited from DictionarySet.)
RetainAll
Retains only the elements in this set that are contained in the specified collection.
(Inherited from DictionarySet.)

Protected Fields

  NameDescription
InternalDictionary
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.
(Inherited from DictionarySet.)

Public Constructors

  NameDescription
ListSetNewOverloaded.

Public Properties

  NameDescription
Count
The number of elements contained in this collection.
(Inherited from DictionarySet.)
IsEmpty
Returns trueTruetrue if this set contains no elements.
(Inherited from DictionarySet.)
IsSynchronized
None of the objects based on DictionarySet are synchronized. Use the SyncRoot property instead.
(Inherited from DictionarySet.)
SyncRoot
Returns an object that can be used to synchronize the Set between threads.
(Inherited from DictionarySet.)

Protected Properties

  NameDescription
Placeholder
The placeholder object used as the value for the IDictionary instance.
(Inherited from DictionarySet.)