Table of Contents

Class ConcurrentCollector<T>

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 collection.

public class ConcurrentCollector<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

The element type in the collection.

Inheritance
ConcurrentCollector<T>
Implements
Extension Methods

Constructors

ConcurrentCollector(int)

public ConcurrentCollector(int capacity = 16)

Parameters

capacity int

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

The number of elements in the collection.

this[int]

Gets the element at the specified index in the read-only list.

public T this[int index] { get; set; }

Parameters

index int

The zero-based index of the element to get.

Property Value

T

The element at the specified index in the read-only list.

Items

Gets the underlying array. It is an error to access Items after adding elements, but before closing.

public T[] Items { get; }

Property Value

T[]

Methods

Add(T)

public int Add(T item)

Parameters

item T

Returns

int

AddRange(IReadOnlyList<T>)

public void AddRange(IReadOnlyList<T> collection)

Parameters

collection IReadOnlyList<T>

Clear(bool)

Clears the collection. If fastClear is true, the underlying array is not cleared.

public void Clear(bool fastClear)

Parameters

fastClear bool

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

ConcurrentCollector<T>.Enumerator