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<Int32> | 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>, Int32)
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 |
Int32 | maxElements | the maximum number of elements to transfer |
Returns
Task<Int32> | 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.