Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    KeyedSortedList<TKey, T> Class

    Namespace: Stride.Core.Collections
    Assembly: Stride.Core.dll

    List of items, stored sequentially and sorted by an implicit invariant key that are extracted from items by implementing GetKeyForItem(T).

    System.Object → KeyedSortedList<TKey, T>
    Derived from KeyedSortedList<TKey, T>: RootAssetCollection

    public abstract class KeyedSortedList<TKey, T> : ICollection<T>, IEnumerable<T>, ICollection, IEnumerable
    Type Parameters
    Name Description
    TKey

    The type of the key.

    T

    The type of the item in the collection.

    Name Description
    Constructors
    KeyedSortedList()
    KeyedSortedList(IComparer<TKey>)
    Fields
    items
    Properties
    Count
    Item[TKey]
    Item[Int32]
    Methods
    Add(T)
    BinarySearch(TKey)
    Clear()
    Contains(T)
    ContainsKey(TKey)
    GetEnumerator()
    GetKeyForItem(T)

    Extracts the key for the specified element.

    IndexOf(T)
    InsertItem(Int32, T)

    Called every time an item should be added at a given index.

    Remove(TKey)
    Remove(T)
    RemoveItem(Int32)

    Called every time an item should be removed at a given index.

    Sort()

    Sorts again this list (in case keys were mutated).

    TryGetValue(TKey, out T)
    Explicit Interface Implementations
    ICollection<T>.CopyTo(T[], Int32)
    ICollection<T>.IsReadOnly
    ICollection<T>.Remove(T)
    IEnumerable<T>.GetEnumerator()
    ICollection.CopyTo(Array, Int32)
    ICollection.IsSynchronized
    ICollection.SyncRoot
    IEnumerable.GetEnumerator()
    | Improve this Doc View Source

    Constructors


    KeyedSortedList()

    protected KeyedSortedList()

    KeyedSortedList(IComparer<TKey>)

    protected KeyedSortedList(IComparer<TKey> comparer)
    Parameters
    Type Name Description
    System.Collections.Generic.IComparer<TKey> comparer
    | Improve this Doc View Source

    Fields


    items

    protected FastListStruct<T> items
    Field Value
    Type Description
    FastListStruct<T>
    | Improve this Doc View Source

    Properties


    Count

    public int Count { get; }
    Property Value
    Type Description
    System.Int32

    Item[TKey]

    public T this[TKey key] { get; set; }
    Parameters
    Type Name Description
    TKey key
    Property Value
    Type Description
    T

    Item[Int32]

    public T this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type Description
    T
    | Improve this Doc View Source

    Methods


    Add(T)

    public void Add(T item)
    Parameters
    Type Name Description
    T item

    BinarySearch(TKey)

    public int BinarySearch(TKey searchKey)
    Parameters
    Type Name Description
    TKey searchKey
    Returns
    Type Description
    System.Int32

    Clear()

    public void Clear()

    Contains(T)

    public bool Contains(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    System.Boolean

    ContainsKey(TKey)

    public bool ContainsKey(TKey key)
    Parameters
    Type Name Description
    TKey key
    Returns
    Type Description
    System.Boolean

    GetEnumerator()

    public KeyedSortedList<TKey, T>.Enumerator GetEnumerator()
    Returns
    Type Description
    KeyedSortedList.Enumerator<>

    GetKeyForItem(T)

    Extracts the key for the specified element.

    protected abstract TKey GetKeyForItem(T item)
    Parameters
    Type Name Description
    T item

    The element from which to extract the key.

    Returns
    Type Description
    TKey

    The key for the specified item.


    IndexOf(T)

    public int IndexOf(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    System.Int32

    InsertItem(Int32, T)

    Called every time an item should be added at a given index.

    protected virtual void InsertItem(int index, T item)
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    T item

    The item.


    Remove(TKey)

    public bool Remove(TKey key)
    Parameters
    Type Name Description
    TKey key
    Returns
    Type Description
    System.Boolean

    Remove(T)

    public void Remove(T item)
    Parameters
    Type Name Description
    T item

    RemoveItem(Int32)

    Called every time an item should be removed at a given index.

    protected virtual void RemoveItem(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The index.


    Sort()

    Sorts again this list (in case keys were mutated).

    public void Sort()

    TryGetValue(TKey, out T)

    public bool TryGetValue(TKey key, out T value)
    Parameters
    Type Name Description
    TKey key
    T value
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Explicit Interface Implementations


    ICollection<T>.CopyTo(T[], Int32)

    void ICollection<T>.CopyTo(T[] array, int arrayIndex)
    Parameters
    Type Name Description
    T[] array
    System.Int32 arrayIndex

    ICollection<T>.IsReadOnly

    bool ICollection<T>.IsReadOnly { get; }
    Returns
    Type Description
    System.Boolean

    ICollection<T>.Remove(T)

    bool ICollection<T>.Remove(T item)
    Parameters
    Type Name Description
    T item
    Returns
    Type Description
    System.Boolean

    IEnumerable<T>.GetEnumerator()

    IEnumerator<T> IEnumerable<T>.GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<T>

    ICollection.CopyTo(Array, Int32)

    void ICollection.CopyTo(Array array, int arrayIndex)
    Parameters
    Type Name Description
    System.Array array
    System.Int32 arrayIndex

    ICollection.IsSynchronized

    bool ICollection.IsSynchronized { get; }
    Returns
    Type Description
    System.Boolean

    ICollection.SyncRoot

    object ICollection.SyncRoot { get; }
    Returns
    Type Description
    System.Object

    IEnumerable.GetEnumerator()

    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    ArrayExtensions.ComputeHash<T>(ICollection<T>, IEqualityComparer<T>)
    EnumerableExtensions.IsNullOrEmpty(IEnumerable)
    EnumerableExtensions.ForEach<T>(IEnumerable, Action<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
    EnumerableExtensions.IndexOf<T>(IEnumerable<T>, Func<T, Boolean>)
    EnumerableExtensions.LastIndexOf<T>(IEnumerable<T>, Func<T, Boolean>)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation