LinkedHashSet<T> Class
Hash table and linked list implementation of the ISet<T> interface, with predictable iteration order.
public sealed class LinkedHashSet<T> : ISet<T>
where T : notnull
Type Parameters
- T
-
notnull
The type of elements maintained by this set.
- Inheritance
-
Linked
Hash Set<T>
- Implements
Remarks
This implementation differs from HashSet<T> in that it
maintains a doubly-linked list running through all of its entries. This
linked list defines the iteration ordering, which is the order in which
elements were inserted into the set (insertion-order). Note that
insertion order is not affected if an element is re-inserted
into the set. (An element e
is reinserted into a set s
if
s.Add(e)
is invoked when s.Contains(e)
would return
true
immediately prior to the invocation.)
Constructors
Linked |
Initializes a new instance of the LinkedHashSet<T> class. |
Linked |
Initializes a new instance of the LinkedHashSet<T> class. |
Properties
Methods
Explicit Interface Implementations
Constructors Detail
LinkedHashSet()
Initializes a new instance of the LinkedHashSet<T> class.
public LinkedHashSet()
LinkedHashSet(int)
Initializes a new instance of the LinkedHashSet<T> class.
public LinkedHashSet(int initialCapacity)
Parameters
- initialCapacity
- int
The initial capacity.
Properties Detail
Count
public int Count { get; }
Property Value
Implements
IsReadOnly
public bool IsReadOnly { get; }
Property Value
Implements
Methods Detail
Add(T)
public bool Add(T item)
Parameters
- item
- T
Returns
Implements
Clear()
public void Clear()
Implements
Contains(T)
public bool Contains(T item)
Parameters
- item
- T
Returns
Implements
CopyTo(T[], int)
public void CopyTo(T[] array, int arrayIndex)
Parameters
- array
- T[]
- arrayIndex
- int
Implements
ExceptWith(IEnumerable<T>)
public void ExceptWith(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Implements
GetEnumerator()
public IEnumerator<T> GetEnumerator()
Returns
Implements
IntersectWith(IEnumerable<T>)
public void IntersectWith(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Implements
IsProperSubsetOf(IEnumerable<T>)
public bool IsProperSubsetOf(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Returns
Implements
IsProperSupersetOf(IEnumerable<T>)
public bool IsProperSupersetOf(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Returns
Implements
IsSubsetOf(IEnumerable<T>)
public bool IsSubsetOf(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Returns
Implements
IsSupersetOf(IEnumerable<T>)
public bool IsSupersetOf(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Returns
Implements
Overlaps(IEnumerable<T>)
public bool Overlaps(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Returns
Implements
Remove(T)
public bool Remove(T item)
Parameters
- item
- T
Returns
Implements
SetEquals(IEnumerable<T>)
public bool SetEquals(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Returns
Implements
SymmetricExceptWith(IEnumerable<T>)
public void SymmetricExceptWith(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Implements
UnionWith(IEnumerable<T>)
public void UnionWith(IEnumerable<T> other)
Parameters
- other
- IEnumerable<T>
Implements
Explicit Interface Implementations Detail
ICollection<T>.Add(T)
private void ICollection<T>.Add(T item)
Parameters
- item
- T
Implements
IEnumerable.GetEnumerator()
private IEnumerator IEnumerable.GetEnumerator()