BlockingCollection<T>.TakeFromAny Método
Definição
Toma um item de qualquer uma das instâncias BlockingCollection<T> especificadas.Takes an item from any one of the specified BlockingCollection<T> instances.
Sobrecargas
| TakeFromAny(BlockingCollection<T>[], T) |
Toma um item de qualquer uma das instâncias BlockingCollection<T> especificadas.Takes an item from any one of the specified BlockingCollection<T> instances. |
| TakeFromAny(BlockingCollection<T>[], T, CancellationToken) |
Recebe um item de qualquer uma das instâncias BlockingCollection<T> especificadas, observando ao mesmo tempo o token de cancelamento especificado.Takes an item from any one of the specified BlockingCollection<T> instances while observing the specified cancellation token. |
TakeFromAny(BlockingCollection<T>[], T)
Toma um item de qualquer uma das instâncias BlockingCollection<T> especificadas.Takes an item from any one of the specified BlockingCollection<T> instances.
public:
static int TakeFromAny(cli::array <System::Collections::Concurrent::BlockingCollection<T> ^> ^ collections, [Runtime::InteropServices::Out] T % item);
public static int TakeFromAny (System.Collections.Concurrent.BlockingCollection<T>[] collections, out T item);
public static int TakeFromAny (System.Collections.Concurrent.BlockingCollection<T>[] collections, out T? item);
static member TakeFromAny : System.Collections.Concurrent.BlockingCollection<'T>[] * 'T -> int
Public Shared Function TakeFromAny (collections As BlockingCollection(Of T)(), ByRef item As T) As Integer
Parâmetros
- collections
- BlockingCollection<T>[]
A matriz de coleções.The array of collections.
- item
- T
O item removido de uma das coleções.The item removed from one of the collections.
Retornos
O índice da coleção na matriz collections da qual o item foi removido.The index of the collection in the collections array from which the item was removed.
Exceções
Pelo menos uma das instâncias de BlockingCollection<T> foi descartada.At least one of the BlockingCollection<T> instances has been disposed.
O argumento collections é nulo.The collections argument is null.
A contagem de collections é maior que o tamanho máximo de 62 para STA e 63 para MTA.The count of collections is greater than the maximum size of 62 for STA and 63 for MTA.
O argumento collections é uma matriz de tamanho 0 ou contém um elemento nulo ou CompleteAdding() foi chamado na coleção.The collections argument is a 0-length array or contains a null element or CompleteAdding() has been called on the collection.
Pelo menos uma das coleções subjacentes foi alterada fora da instância de BlockingCollection<T>.At least one of the underlying collections was modified outside of its BlockingCollection<T> instance.
Comentários
Uma chamada para TakeFromAny pode ser bloqueada até que um item esteja disponível para ser removido.A call to TakeFromAny may block until an item is available to be removed.
Aplica-se a
TakeFromAny(BlockingCollection<T>[], T, CancellationToken)
Recebe um item de qualquer uma das instâncias BlockingCollection<T> especificadas, observando ao mesmo tempo o token de cancelamento especificado.Takes an item from any one of the specified BlockingCollection<T> instances while observing the specified cancellation token.
public:
static int TakeFromAny(cli::array <System::Collections::Concurrent::BlockingCollection<T> ^> ^ collections, [Runtime::InteropServices::Out] T % item, System::Threading::CancellationToken cancellationToken);
public static int TakeFromAny (System.Collections.Concurrent.BlockingCollection<T>[] collections, out T item, System.Threading.CancellationToken cancellationToken);
public static int TakeFromAny (System.Collections.Concurrent.BlockingCollection<T>[] collections, out T? item, System.Threading.CancellationToken cancellationToken);
static member TakeFromAny : System.Collections.Concurrent.BlockingCollection<'T>[] * 'T * System.Threading.CancellationToken -> int
Public Shared Function TakeFromAny (collections As BlockingCollection(Of T)(), ByRef item As T, cancellationToken As CancellationToken) As Integer
Parâmetros
- collections
- BlockingCollection<T>[]
A matriz de coleções.The array of collections.
- item
- T
O item removido de uma das coleções.The item removed from one of the collections.
- cancellationToken
- CancellationToken
Um token de cancelamento a ser observado.A cancellation token to observe.
Retornos
O índice da coleção na matriz collections da qual o item foi removido.The index of the collection in the collections array from which the item was removed.
Exceções
Se o padrão CancellationToken for cancelado.If the CancellationToken is canceled.
Pelo menos uma das coleções subjacentes foi alterada fora da instância de BlockingCollection<T>.At least one of the underlying collections was modified outside of its BlockingCollection<T> instance.
O argumento collections é nulo.The collections argument is null.
A contagem de collections é maior que o tamanho máximo de 62 para STA e 63 para MTA.The count of collections is greater than the maximum size of 62 for STA and 63 for MTA.
O argumento collections é uma matriz de comprimento zero ou contém um elemento nulo, ou CompleteAdding() foi chamado na coleção.The collections argument is a 0-length array or contains a null element, or CompleteAdding() has been called on the collection.
Pelo menos uma das instâncias de BlockingCollection<T> foi descartada.At least one of the BlockingCollection<T> instances has been disposed.
Comentários
Uma chamada para TakeFromAny pode ser bloqueada até que um item esteja disponível para ser removido.A call to TakeFromAny may block until an item is available to be removed. O método retornará antecipadamente com um OperationCanceledException se o token for cancelado.The method will return early with an OperationCanceledException if the token is canceled.