語言

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 被移除的物件。 若無物件可移除,該值未指定。

傳回

true若元素被移除並成功返回;否則,。 false

實作

備註

對於 ConcurrentStack<T>,此操作將嘗試彈出位於 ConcurrentStack<T>頂部的物件。

適用於

另請參閱