Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    FastCollection<T> Class

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

    Faster and lighter implementation of System.Collections.ObjectModel.Collection<T> with value types enumerators to avoid allocation in foreach loops, and various helper functions.

    System.Object → FastCollection<T>
    Derived from FastCollection<T>: FastTrackingCollection<T> TrackingCollection<T> EntityComponentCollection PhysicsComponent.ColliderShapeCollection TransformComponent.TransformChildrenCollection MaterialPassCollection

    [DataSerializer(typeof(ListAllSerializer<, >), Mode = DataSerializerGenericMode.TypeAndGenericArguments)]
    public class FastCollection<T> : IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    Type of elements of this collection

    Name Description
    Constructors
    FastCollection()
    FastCollection(IEnumerable<T>)
    FastCollection(Int32)
    Properties
    Capacity
    Count
    Item[Int32]

    Gets or sets the element at the specified index.

    Methods
    Add(T)
    AddRange<TE>(TE)

    Adds the elements of the specified source to the end of FastCollection<T>.

    Clear()
    ClearItems()
    Contains(T)
    CopyTo(T[], Int32)
    EnsureCapacity(Int32)
    GetEnumerator()

    Inline Enumerator used directly by foreach.

    IndexOf(T)
    Insert(Int32, T)
    InsertItem(Int32, T)
    Remove(T)
    RemoveAt(Int32)
    RemoveItem(Int32)
    SetItem(Int32, T)
    Sort()
    Sort(IComparer<T>)
    Sort(Int32, Int32, IComparer<T>)
    Explicit Interface Implementations
    ICollection<T>.IsReadOnly
    IEnumerable<T>.GetEnumerator()
    IEnumerable.GetEnumerator()
    | Improve this Doc View Source

    Constructors


    FastCollection()

    public FastCollection()

    FastCollection(IEnumerable<T>)

    public FastCollection(IEnumerable<T> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> collection

    FastCollection(Int32)

    public FastCollection(int capacity)
    Parameters
    Type Name Description
    System.Int32 capacity
    | Improve this Doc View Source

    Properties


    Capacity

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

    Count

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

    Item[Int32]

    Gets or sets the element at the specified index.

    public T this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    Property Value
    Type Description
    T

    The element .

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    If index is out of range

    | Improve this Doc View Source

    Methods


    Add(T)

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

    AddRange<TE>(TE)

    Adds the elements of the specified source to the end of FastCollection<T>.

    public void AddRange<TE>(TE itemsArgs)
        where TE : IEnumerable<T>
    Parameters
    Type Name Description
    TE itemsArgs

    The items to add to this collection.

    Type Parameters
    Name Description
    TE

    Clear()

    public void Clear()

    ClearItems()

    protected virtual void ClearItems()

    Contains(T)

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

    CopyTo(T[], Int32)

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

    EnsureCapacity(Int32)

    public void EnsureCapacity(int min)
    Parameters
    Type Name Description
    System.Int32 min

    GetEnumerator()

    Inline Enumerator used directly by foreach.

    public FastCollection<T>.Enumerator GetEnumerator()
    Returns
    Type Description
    FastCollection.Enumerator<>

    An enumerator of this collection


    IndexOf(T)

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

    Insert(Int32, T)

    public void Insert(int index, T item)
    Parameters
    Type Name Description
    System.Int32 index
    T item

    InsertItem(Int32, T)

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

    Remove(T)

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

    RemoveAt(Int32)

    public void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    RemoveItem(Int32)

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

    SetItem(Int32, T)

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

    Sort()

    public void Sort()

    Sort(IComparer<T>)

    public void Sort(IComparer<T> comparer)
    Parameters
    Type Name Description
    System.Collections.Generic.IComparer<T> comparer

    Sort(Int32, Int32, IComparer<T>)

    public void Sort(int index, int count, IComparer<T> comparer)
    Parameters
    Type Name Description
    System.Int32 index
    System.Int32 count
    System.Collections.Generic.IComparer<T> comparer
    | Improve this Doc View Source

    Explicit Interface Implementations


    ICollection<T>.IsReadOnly

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

    IEnumerable<T>.GetEnumerator()

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

    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>)
    CollectionExtensions.SwapRemove<T>(IList<T>, T)
    CollectionExtensions.SwapRemoveAt<T>(IList<T>, Int32)
    CollectionExtensions.IndexOf<T>(IReadOnlyList<T>, 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