[This is preliminary documentation and is subject to change.]
Represents a set of objects of a given type.
Declaration Syntax
C# |
public class Set<T> : ICollection<T>, IEnumerable<T>, IEnumerable
Generic Template Parameters
- T
- The type of the members of the set.
Members
All Members | Constructors | Methods | Properties | ||
Icon | Member | Description |
---|---|---|
Set<(Of <(<'T>)>)>()()()() | Create a new empty Set with the default initial capacity.
| |
Set<(Of <(<'T>)>)>(Int32) | Create a new empty Set with a given initial capacity. | |
Add(T) | Add an item to the set. If the item is already in the set, no
action is taken. | |
AddRange(ICollection<(Of <<'(T>)>>)) | Adds a collection of items to the set. Only those items not
already in the set are added. | |
AddRangeExcept(ICollection<(Of <<'(T>)>>), T) | Adds a collection of items to the Set. Only those items not
already in the set, and which are not equal to a particular item, are
added. | |
AverageAdvance()()()() |
Obtains the average "advance" of items in the Set. This is the average
number of items that have to be checked on each index into the set.
| |
CheckSet()()()() |
Checks validity of the set
| |
Clear()()()() | Removes all items from the Set. | |
Contains(T) | Determines if a particular item is in the set. | |
CopyTo(array<T>[]()[][], Int32) | Copies the contents of the set to an Array. | |
Count | Gets the number of items in the set. | |
Equals(Object) | (Inherited from Object.) | |
Finalize()()()() |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.) | |
GetEnumerator()()()() | Obtains an enumerator to iterate through the set members.
| |
GetHashCode()()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
GetType()()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
IsReadOnly | Gets a value indicating whether the set is read only.
Always false. | |
MaxAdvance()()()() |
Obtains the maximum "advance" of items in the Set. This is the maximum
number of items that ever have to be checked on an index into the set.
| |
MemberwiseClone()()()() |
Creates a shallow copy of the current Object.
(Inherited from Object.) | |
Remove(T) | Removes an item from the set if it contains it. | |
ToString()()()() | (Inherited from Object.) |
Remarks
This class implements ICollection{T} and the particular aspect is that the Contains and Remove methods are all O(1). All methods are similar to those found in other collection types, except the AddRangeExcept convenience method, which adds a range of objects to the Set, except for a particular one.
This is a (sparse) replacement for HashSet and is here only because we want to be able to target .Net 2.
Inheritance Hierarchy
Object | |
Set<(Of <(<'T>)>)> |