ImmutableInterlocked.TryDequeue<T>(ImmutableQueue<T>, T) 方法

定义

以原子方式移除和返回位于队列开头处的指定元素(如果队列不为空)。Atomically removes and returns the specified element at the head of the queue, if the queue is not empty.

public:
generic <typename T>
 static bool TryDequeue(System::Collections::Immutable::ImmutableQueue<T> ^ % location, [Runtime::InteropServices::Out] T % value);
public static bool TryDequeue<T> (ref System.Collections.Immutable.ImmutableQueue<T> location, out T value);
static member TryDequeue : ImmutableQueue * 'T -> bool
Public Shared Function TryDequeue(Of T) (ByRef location As ImmutableQueue(Of T), ByRef value As T) As Boolean

类型参数

T

队列中项的类型。The type of items in the queue.

参数

location
ImmutableQueue<T>

以原子方式更新的变量或字段。The variable or field to atomically update.

value
T

设置为队列开头位置的值(如果队列不为空)。Set to the value from the head of the queue, if the queue not empty.

返回

Boolean

如果队列不为空并且已移除头元素,则为 true;否则为 falsetrue if the queue is not empty and the head element is removed; otherwise, false.

适用于