ConcurrentStack<T>.TryPopRange Método

Definição

Sobrecargas

TryPopRange(T[], Int32, Int32)

Tenta remover e retornar vários objetos da parte superior do ConcurrentStack<T> de forma atômica.Attempts to pop and return multiple objects from the top of the ConcurrentStack<T> atomically.

TryPopRange(T[])

Tenta remover e retornar vários objetos da parte superior do ConcurrentStack<T> de forma atômica.Attempts to pop and return multiple objects from the top of the ConcurrentStack<T> atomically.

TryPopRange(T[], Int32, Int32)

Tenta remover e retornar vários objetos da parte superior do ConcurrentStack<T> de forma atômica.Attempts to pop and return multiple objects from the top of the ConcurrentStack<T> atomically.

public:
 int TryPopRange(cli::array <T> ^ items, int startIndex, int count);
public int TryPopRange (T[] items, int startIndex, int count);
member this.TryPopRange : 'T[] * int * int -> int
Public Function TryPopRange (items As T(), startIndex As Integer, count As Integer) As Integer

Parâmetros

items
T[]

O Array a que os objetos removidos da parte superior de ConcurrentStack<T> serão adicionados.The Array to which objects popped from the top of the ConcurrentStack<T> will be added.

startIndex
Int32

O deslocamento de base zero em items no qual começar a inserir elementos da parte superior do ConcurrentStack<T>.The zero-based offset in items at which to begin inserting elements from the top of the ConcurrentStack<T>.

count
Int32

O número de elementos a serem removidos da parte superior do ConcurrentStack<T> e inseridos em items.The number of elements to be popped from top of the ConcurrentStack<T> and inserted into items.

Retornos

Int32

O número de objetos removidos com êxito da parte superior da pilha e inseridos no items.The number of objects successfully popped from the top of the stack and inserted in items.

Exceções

items é uma referência nula (Nada no Visual Basic).items is a null reference (Nothing in Visual Basic).

startIndex ou count é negativo.startIndex or count is negative. Ou startIndex é maior que ou igual ao comprimento da items.Or startIndex is greater than or equal to the length of items.

startIndex + count é maior que o comprimento do items.startIndex + count is greater than the length of items.

Comentários

Ao remover vários itens, se houver pouca contenção na pilha, usar TryPopRange pode ser mais eficiente do que usar TryPop uma vez por item a ser removido.When popping multiple items, if there is little contention on the stack, using TryPopRange can be more efficient than using TryPop once per item to be removed. Os nós preenchem a items matriz com o primeiro item a ser exibido em startIndex, o segundo item a ser exibido em startIndex + 1 e assim por diante.Nodes fill the items array with the first item to be popped at the startIndex, the second item to be popped at startIndex + 1, and so on.

Aplica-se a

TryPopRange(T[])

Tenta remover e retornar vários objetos da parte superior do ConcurrentStack<T> de forma atômica.Attempts to pop and return multiple objects from the top of the ConcurrentStack<T> atomically.

public:
 int TryPopRange(cli::array <T> ^ items);
public int TryPopRange (T[] items);
member this.TryPopRange : 'T[] -> int
Public Function TryPopRange (items As T()) As Integer

Parâmetros

items
T[]

O Array a que os objetos removidos da parte superior de ConcurrentStack<T> serão adicionados.The Array to which objects popped from the top of the ConcurrentStack<T> will be added.

Retornos

Int32

O número de objetos removidos com êxito da parte superior do ConcurrentStack<T> e inseridos no items.The number of objects successfully popped from the top of the ConcurrentStack<T> and inserted in items.

Exceções

items é um argumento nulo (Nada no Visual Basic).items is a null argument (Nothing in Visual Basic).

Comentários

Ao remover vários itens, se houver pouca contenção na pilha, o uso TryPopRange poderá ser mais eficiente do que usar TryPop uma vez por item a ser removido.When popping multiple items, if there is little contention on the stack, using TryPopRange can be more efficient than using TryPop once per item to be removed. Os nós preenchem a items matriz com o primeiro item a ser exibido em startIndex, o segundo item a ser exibido em startIndex + 1 e assim por diante.Nodes fill the items array with the first item to be popped at the startIndex, the second item to be popped at startIndex + 1, and so on.

Para obter um exemplo de código, consulte ConcurrentStack<T>.For a code example, see ConcurrentStack<T>.

Aplica-se a