ConcurrentStack<T>.IsEmpty 属性

定义

获取一个值,该值指示 ConcurrentStack<T> 是否为空。

public:
 property bool IsEmpty { bool get(); };
public bool IsEmpty { get; }
member this.IsEmpty : bool
Public ReadOnly Property IsEmpty As Boolean

属性值

Boolean

如果 true 为空,则为 ConcurrentStack<T>;否则为 false

注解

若要确定集合是否包含任何项,建议使用此属性,而不是从 Count 属性检索项数并将其与 0 进行比较。 但是,由于此集合旨在同时访问,因此,在返回后 IsEmpty ,另一个线程可能会修改集合,从而使结果失效。

有关代码示例,请参阅 ConcurrentStack<T>

适用于

另请参阅