class · System.Threading
BlockingCollection<T>
public class System.Threading.BlockingCollection<T> : System.Any
A queue that hands items from producers to consumers: Take waits for an item; after CompleteAdding, Take on an empty queue throws and TryTake gives false.
- Tipo
- class
- Espacio de nombres
- System.Threading
- Ensamblado
- System.Core
- Acceso
- public, final
- Archivo fuente
Threading.ant
Parámetros de tipo
| Nombre | Restricciones |
|---|---|
T | cualquier tipo |
Herencia
- Clases base
-
AnyBlockingCollection<T>
Constructores
constructor BlockingCollection()
#
Propiedades
Métodos
method Add(item: T) -> void
#
method Take() -> T
#
The next item (waiting for one).
Whether an item can be taken (waiting for one, unless adding is complete); then Take gives it at once to this consumer only if no other one takes it first.
method CompleteAdding() -> void
#
method Dispose() -> void
#
Frees what it holds (it must not be used after).
Miembros privados e internos (5)
field mutex: System.Threading.Mutex
#
field changed: System.Threading.Condition
#
field items: System.Queue<T>
#
Miembros heredados (5)
GetTypemétodo de AnyUndescribedmétodo de AnyToStringmétodo de AnyHashmétodo de Anydestroymétodo de Any
Código fuente
BlockingCollection<T> en Larva HIR, descompilado a partir de su Larva HIR.
// A queue that hands items from producers to consumers: Take waits for an item; after CompleteAdding, Take on an
// empty queue throws and TryTake gives false.
public class System.Threading.BlockingCollection<T> : System.Any
{
field mutex: System.Threading.Mutex
field changed: System.Threading.Condition
field items: System.Queue<T>
field completed: bool
field waiters: i32
constructor BlockingCollection()
method Add(item: T) -> void
// The next item (waiting for one).
method Take() -> T
// Whether an item can be taken (waiting for one, unless adding is complete); then Take gives it at once to
// this consumer only if no other one takes it first.
method WaitForItem() -> bool
method CompleteAdding() -> void
// Frees what it holds (it must not be used after).
method Dispose() -> void
property IsAddingCompleted: bool
property IsCompleted: bool
property Count: i32
}