ConcurrentStack<T>.TryPop(T) 方法

定义

尝试弹出并返回 ConcurrentStack<T> 顶部的对象。Attempts to pop and return the object at the top of the ConcurrentStack<T>.

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

参数

result
T

如果操作成功,则此方法返回时,result 包含所移除的对象。When this method returns, if the operation was successful, result contains the object removed. 如果没有可供移除的对象,则不指定该值。If no object was available to be removed, the value is unspecified.

返回

如果从 true 的顶部成功删除并返回了元素,则为 ConcurrentStack<T>;否则为 falsetrue if an element was removed and returned from the top of the ConcurrentStack<T> successfully; otherwise, false.

注解

有关代码示例,请参阅ConcurrentStack<T>For a code example, see ConcurrentStack<T>.

适用于