ConcurrentStack<T>.TryPeek(T) 方法

定义

尝试从 ConcurrentStack<T> 的顶部返回一个对象而无需移除它。Attempts to return an object from the top of the ConcurrentStack<T> without removing it.

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

参数

result
T

当此方法返回时,result 包含来自 ConcurrentStack<T> 顶部的一个对象,或者如果操作失败,则包含一个未指定的值。When this method returns, result contains an object from the top of the ConcurrentStack<T> or an unspecified value if the operation failed.

返回

如果成功返回了对象,则为 true;否则为 falsetrue if and object was returned successfully; otherwise, false.

适用于

另请参阅