Class OrderedHashSet<T>
A custom collection similar to HashSet{T} which only contains unique items, however this collection keeps items in order and is customizable to keep the newest or oldest equatable item
Inheritance
object
Collection<T>
KeyedCollection<T, T>
Namespace: Umbraco.Cms.Core.Collections
Assembly: Umbraco.Core.dll
Syntax
public class OrderedHashSet<T> : KeyedCollection<T, T> where T : notnull
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
View SourceOrderedHashSet(bool)
Declaration
public OrderedHashSet(bool keepOldest = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | keepOldest |
Methods
View SourceGetKeyForItem(T)
When implemented in a derived class, extracts the key from the specified element.
Declaration
protected override T GetKeyForItem(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The element from which to extract the key. |
Returns
| Type | Description |
|---|---|
| T | The key for the specified element. |
InsertItem(int, T)
Inserts an element into the System.Collections.ObjectModel.KeyedCollection<TKey, TItem> at the specified index.
Declaration
protected override void InsertItem(int index, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index at which |
| T | item | The object to insert. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
-or-
|