Class BusyBlockingCollection<T>
- Namespace
- FinanceSharp
- Assembly
- FinanceSharp.dll
A small wrapper around BlockingCollection<T> used to communicate busy state of the items being processed
public class BusyBlockingCollection<T> : IBusyCollection<T>, IDisposable
Type Parameters
TThe item type being processed
- Inheritance
-
BusyBlockingCollection<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
BusyBlockingCollection()
Initializes a new instance of the BusyBlockingCollection<T> class with a bounded capacity of MaxValue
public BusyBlockingCollection()
BusyBlockingCollection(int)
Initializes a new instance of the BusyBlockingCollection<T> class
with the specified boundedCapacity
public BusyBlockingCollection(int boundedCapacity)
Parameters
boundedCapacityintThe maximum number of items allowed in the collection
Properties
Count
Gets the number of items held within this collection
public int Count { get; }
Property Value
IsBusy
Returns true if processing, false otherwise
public bool IsBusy { get; }
Property Value
WaitHandle
Gets a wait handle that can be used to wait until this instance is done processing all of it's item
public WaitHandle WaitHandle { get; }
Property Value
Methods
Add(T)
Adds the items to this collection
public void Add(T item)
Parameters
itemTThe item to be added
Add(T, CancellationToken)
Adds the items to this collection
public void Add(T item, CancellationToken cancellationToken)
Parameters
itemTThe item to be added
cancellationTokenCancellationTokenA cancellation token to observer
CompleteAdding()
Marks the BusyBlockingCollection<T> as not accepting any more additions
public void CompleteAdding()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetConsumingEnumerable()
Provides a consuming enumerable for items in this collection.
public IEnumerable<T> GetConsumingEnumerable()
Returns
- IEnumerable<T>
An enumerable that removes and returns items from the collection
GetConsumingEnumerable(CancellationToken)
Provides a consuming enumerable for items in this collection.
public IEnumerable<T> GetConsumingEnumerable(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA cancellation token to observer
Returns
- IEnumerable<T>
An enumerable that removes and returns items from the collection