Class ConcurrentCollector<T>
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>, IEnumerableType Parameters
- T
- The element type in the collection. 
- Inheritance
- 
      objectConcurrentCollector<T>
- Implements
- 
      
      
      IEnumerable<T>
- Extension Methods
Constructors
ConcurrentCollector(int)
public ConcurrentCollector(int capacity = 16)Parameters
- capacityint
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
- indexint
- 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
- itemT
Returns
AddRange(IReadOnlyList<T>)
public void AddRange(IReadOnlyList<T> collection)Parameters
- collectionIReadOnlyList<T>
Clear(bool)
Clears the collection. If fastClear is true, the underlying array is not cleared.
public void Clear(bool fastClear)Parameters
- fastClearbool
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()