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)

    Initializes a new instance of the OrderedHashSet<T> class.

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

    When true, the oldest item is kept when a duplicate is added; when false, the newest item replaces the oldest.

    Methods

    View Source

    GetKeyForItem(T)

    Declaration
    protected override T GetKeyForItem(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    T
    View Source

    InsertItem(int, T)

    Declaration
    protected override void InsertItem(int index, T item)
    Parameters
    Type Name Description
    int index
    T item
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX