ConcurrentBag<T>.TryTake(T) ConcurrentBag<T>.TryTake(T) ConcurrentBag<T>.TryTake(T) ConcurrentBag<T>.TryTake(T) Method

定義

嘗試從 ConcurrentBag<T> 中移除及傳回物件。Attempts to remove and return an object from the ConcurrentBag<T>.

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

參數

result
T T T T

這個方法傳回時,result 會包含已自 ConcurrentBag<T> 移除的物件,如果 Bag 是空的,則包含 T 的預設值。When this method returns, result contains the object removed from the ConcurrentBag<T> or the default value of T if the bag is empty.

傳回

如果成功移除物件則為 true,否則為 false。true if an object was removed successfully; otherwise, false.

實作

適用於

另請參閱