Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    ConcurrentCollector<T> Class

    Namespace: Stride.Core.Threading
    Assembly: Stride.Core.dll

    A collector that allows for concurrent adding of items, as well as non-thread-safe clearing and accessing of the underlying colletion.

    System.Object → ConcurrentCollector<T>
    Derived from ConcurrentCollector<T>:

    public class ConcurrentCollector<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    The element type in the collection.

    Name Description
    Constructors
    ConcurrentCollector(Int32)
    Properties
    Count
    Item[Int32]
    Items
    Methods
    Add(T)
    AddRange(IReadOnlyList<T>)
    Clear(Boolean)
    Close()

    Consolidates all added items into a single consecutive array. It is an error to access Items after adding elements, but before closing.

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

    Constructors


    ConcurrentCollector(Int32)

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

    Properties


    Count

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

    Item[Int32]

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

    Items

    public T[] Items { get; }
    Property Value
    Type Description
    T[]
    | Improve this Doc View Source

    Methods


    Add(T)

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

    AddRange(IReadOnlyList<T>)

    public void AddRange(IReadOnlyList<T> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.IReadOnlyList<T> collection

    Clear(Boolean)

    public void Clear(bool fastClear)
    Parameters
    Type Name Description
    System.Boolean fastClear

    Close()

    Consolidates all added items into a single consecutive array. It is an error to access Items after adding elements, but before closing.

    public void Close()

    GetEnumerator()

    public ConcurrentCollector<T>.Enumerator GetEnumerator()
    Returns
    Type Description
    ConcurrentCollector.Enumerator<>
    | 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

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    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>)
    ConcurrentCollectorExtensions.Add<T>(ConcurrentCollector<T>, T, ConcurrentCollectorCache<T>)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

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