ConcurrentStack<T>.IProducerConsumerCollection<T>.TryTake 方法

定義

嘗試從 IProducerConsumerCollection<T> 中移除及傳回物件。

 virtual bool System.Collections.Concurrent.IProducerConsumerCollection<T>.TryTake([Runtime::InteropServices::Out] T % item) = System::Collections::Concurrent::IProducerConsumerCollection<T>::TryTake;
bool IProducerConsumerCollection<T>.TryTake (out T item);
abstract member System.Collections.Concurrent.IProducerConsumerCollection<T>.TryTake : 'T -> bool
override this.System.Collections.Concurrent.IProducerConsumerCollection<T>.TryTake : 'T -> bool
Function TryTake (ByRef item As T) As Boolean Implements IProducerConsumerCollection(Of T).TryTake

參數

item
T

如果這個方法會傳回且作業成功,則 item 會包含移除的物件。 如果沒有可移除的物件,值會是 unspecified。

傳回

如已成功移除及傳回元素,則為 true;否則為 false

實作

備註

針對 ConcurrentStack<T> ,此作業會嘗試在 頂端 ConcurrentStack<T> 快顯 物件。

適用於

另請參閱