ConcurrentStack<T>.TryPopRange 方法

定義

多載

名稱 Description
TryPopRange(T[], Int32, Int32)

嘗試從原子頂 ConcurrentStack<T> 端彈跳並返回多個物體。

TryPopRange(T[])

嘗試從原子頂 ConcurrentStack<T> 端彈跳並返回多個物體。

TryPopRange(T[], Int32, Int32)

來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs

嘗試從原子頂 ConcurrentStack<T> 端彈跳並返回多個物體。

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

參數

items
T[]

Array從遺體頂部ConcurrentStack<T>彈出的物品會被加入。

startIndex
Int32

從 中 items 開始插入元素 ConcurrentStack<T>的零基偏移量。

count
Int32

從 頂部 ConcurrentStack<T> 彈出並插入的 items元素數量。

傳回

成功從堆疊頂端彈出並插入的 items物件數量。

例外狀況

items 是空參考(Visual Basic 中無任何參考)。

startIndexcount 是陰性。 或 startIndex 大於或等於 的 items長度。

startIndex + count 大於 的 items長度。

備註

當彈出多個物品時,如果堆疊上競爭較少,使用 TryPopRange 可能比每件物品只移除 TryPop 一次更有效率。 節點會在 startIndex 填入 items 第一個要彈出的項目,第二個要在 startIndex + 1 彈出,依此類推。

另請參閱

適用於

TryPopRange(T[])

來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs
來源:
ConcurrentStack.cs

嘗試從原子頂 ConcurrentStack<T> 端彈跳並返回多個物體。

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

參數

items
T[]

Array從遺體頂部ConcurrentStack<T>彈出的物品會被加入。

傳回

從頂部成功彈 ConcurrentStack<T> 出並插入 items的物件數量。

例外狀況

items 是一個空參數(Visual Basic 中沒有任何參數)。

備註

當多件物品被推出時,如果堆疊上競爭較少,使用 TryPopRange 比每件物品只移除 TryPop 一次更有效率。 節點會在 startIndex 填入 items 第一個要彈出的項目,第二個要在 startIndex + 1 彈出,依此類推。

如需程式碼範例,請參閱ConcurrentStack<T>

另請參閱

適用於