DrainToAsync Method
DrainToAsync(ICollection<T>)
Removes all available elements from this queue and adds them to the given collection.
Declaration
Task<int> DrainToAsync(ICollection<T> items)
Parameters
ICollection<T> | items | the collection to transfer elements into |
Returns
Task<int> | the number of elements transferred |
Remarks
A failure encountered while attempting to Add elements to
collection items
may result in elements being in neither,
either or both collections when the associated exception is
thrown.
DrainToAsync(ICollection<T>, int)
Removes at most the given number of available elements from this queue and adds them to the given collection.
Declaration
Task<int> DrainToAsync(ICollection<T> items, int maxElements)
Parameters
ICollection<T> | items | the collection to transfer elements into |
int | maxElements | the maximum number of elements to transfer |
Returns
Task<int> | the number of elements transferred |
Remarks
A failure encountered while attempting to Add elements to
collection items
may result in elements being in neither,
either or both collections when the associated exception is
thrown.