ConcurrentBag<T>.TryPeek(T) ConcurrentBag<T>.TryPeek(T) ConcurrentBag<T>.TryPeek(T) ConcurrentBag<T>.TryPeek(T) Method

定义

尝试从 ConcurrentBag<T> 返回一个对象但不移除该对象。Attempts to return an object from the ConcurrentBag<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 T T T

此方法返回时,result 包含 ConcurrentBag<T> 中的对象;如果操作失败,则返回 T 的默认值。When this method returns, result contains an object from the ConcurrentBag<T> or the default value of T if the operation failed.

返回

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

适用于

另请参阅