語言

ConcurrentBag<T>.TryTake(T) 方法

定義

嘗試從 中移除並返回 ConcurrentBag<T>物件。

public:
 virtual bool TryTake([Runtime::InteropServices::Out] T % result);
public bool TryTake(out T result);
abstract member TryTake : 'T -> bool
override this.TryTake : 'T -> bool
Public Function TryTake (ByRef result As T) As Boolean

參數

result
T

當此方法回傳時, result 包含從 中移除 ConcurrentBag<T> 的物件,或若袋子為空,則為預設值 T 。

傳回

true如果物品被成功移除;否則,。 false

實作

適用於

另請參閱