ConcurrentQueue<T>.IProducerConsumerCollection<T>.TryTake Method

Definition

Attempts to remove and return an object from the 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

Parameters

item
T

When this method returns, if the operation was successful, item contains the object removed. If no object was available to be removed, the value is unspecified.

Returns

true if an element was removed and returned successfully; otherwise, false.

Implements

Remarks

For ConcurrentQueue<T>, this operation will attempt to remove the object from the beginning of the ConcurrentQueue<T>.

Applies to

See also