HashSet<T>
public class HashSet<T> : ICollection<T>, IEnumerable<T>, IEnumerable, ISet<T>, IReadOnlyCollection<T>
Represents a set of values.To browse the .NET Framework source code for this type, see the Reference Source.
Enumerates the elements of a HashSet<T> object.
Gets the IEqualityComparer<T> object that is used to determine equality for the values in the set.
Gets the number of elements that are contained in a set.
public HashSet()
Initializes a new instance of the HashSet<T> class that is empty and uses the default equality comparer for the set type.
Initializes a new instance of the HashSet<T> class that is empty and uses the specified equality comparer for the set type.
Initializes a new instance of the HashSet<T> class that uses the default equality comparer for the set type, contains elements copied from the specified collection, and has sufficient capacity to accommodate the number of elements copied.
Initializes a new instance of the HashSet<T> class that uses the specified equality comparer for the set type, contains elements copied from the specified collection, and has sufficient capacity to accommodate the number of elements copied.
Adds the specified element to a set.
Removes all elements from a HashSet<T> object.
Determines whether a HashSet<T> object contains the specified element.
Copies the elements of a HashSet<T> object to an array, starting at the specified array index.
Copies the elements of a HashSet<T> object to an array.
Copies the specified number of elements of a HashSet<T> object to an array, starting at the specified array index.
Removes all elements in the specified collection from the current HashSet<T> object.
Returns an enumerator that iterates through a HashSet<T> object.
Modifies the current HashSet<T> object to contain only elements that are present in that object and in the specified collection.
Determines whether a HashSet<T> object is a proper subset of the specified collection.
Determines whether a HashSet<T> object is a proper superset of the specified collection.
Determines whether a HashSet<T> object is a subset of the specified collection.
Determines whether a HashSet<T> object is a superset of the specified collection.
Determines whether the current HashSet<T> object and a specified collection share common elements.
Removes the specified element from a HashSet<T> object.
Removes all elements that match the conditions defined by the specified predicate from a HashSet<T> collection.
Determines whether a HashSet<T> object and the specified collection contain the same elements.
Modifies the current HashSet<T> object to contain only elements that are present either in that object or in the specified collection, but not both.
Sets the capacity of a HashSet<T> object to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.
Modifies the current HashSet<T> object to contain all elements that are present in itself, the specified collection, or both.