Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    PoolListStruct<T> Struct

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

    A pool of objects allocated and can be cleared without loosing previously allocated instance.

    public struct PoolListStruct<T> : IEnumerable<T>, IEnumerable where T : class
    Type Parameters
    Name Description
    T

    Type of the pooled object

    Name Description
    Constructors
    PoolListStruct(Int32, Func<T>)

    Initializes a new instance of the PoolListStruct<T> struct.

    Fields
    Count

    The number of objects in use, readonly.

    Properties
    Item[Int32]

    Gets or sets the item at the specified index.

    Item[UInt32]

    Gets or sets the item at the specified index.

    Methods
    Add()

    Adds a new object in use to this instance.

    Clear()

    Clears objects in use and keep allocated objects.

    GetEnumerator()
    IndexOf(T)

    Gets the index of item

    Remove(T)

    Removes the object from the list

    RemoveAt(Int32)
    Reset()

    Resets this instance by releasing allocated objects.

    Explicit Interface Implementations
    IEnumerable<T>.GetEnumerator()
    IEnumerable.GetEnumerator()
    | Improve this Doc View Source

    Constructors


    PoolListStruct(Int32, Func<T>)

    Initializes a new instance of the PoolListStruct<T> struct.

    public PoolListStruct(int capacity, Func<T> factory)
    Parameters
    Type Name Description
    System.Int32 capacity

    The capacity.

    System.Func<T> factory

    The factory.

    Exceptions
    Type Condition
    System.ArgumentNullException

    factory

    | Improve this Doc View Source

    Fields


    Count

    The number of objects in use, readonly.

    public int Count
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Properties


    Item[Int32]

    Gets or sets the item 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

    An instance of T


    Item[UInt32]

    Gets or sets the item at the specified index.

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

    The index.

    Property Value
    Type Description
    T

    An instance of T

    | Improve this Doc View Source

    Methods


    Add()

    Adds a new object in use to this instance.

    public T Add()
    Returns
    Type Description
    T

    An instance of T


    Clear()

    Clears objects in use and keep allocated objects.

    public void Clear()

    GetEnumerator()

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

    IndexOf(T)

    Gets the index of item

    public int IndexOf(T item)
    Parameters
    Type Name Description
    T item

    The item to get the index of

    Returns
    Type Description
    System.Int32

    Index of the item, or -1 if the item is not in this list


    Remove(T)

    Removes the object from the list

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

    The item to remove

    Remarks

    The item is added back in the pool to be reused for the next Add()


    RemoveAt(Int32)

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

    Reset()

    Resets this instance by releasing allocated objects.

    public void Reset()
    | Improve this Doc View Source

    Explicit Interface Implementations


    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

    Inherited Members

    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    System.ValueType.ToString()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    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>)
    EnumerableExtensions.NotNull<T>(IEnumerable<T>)
    EnumerableExtensions.ToHashCode<T>(IEnumerable<T>)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

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