Search Results for

    Show / Hide Table of Contents
    View Source

    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 Source

    OrderedHashSet(bool)

    Declaration
    public OrderedHashSet(bool keepOldest = true)
    Parameters
    Type Name Description
    bool keepOldest

    Methods

    View Source

    GetKeyForItem(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.

    View Source

    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 item should be inserted.

    T item

    The object to insert.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException
       <code class="paramref">index</code> is less than 0.
    

    -or-

    index is greater than System.Collections.ObjectModel.Collection<T>.Count.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX