ConcurrentQueue<T>.IsEmpty ConcurrentQueue<T>.IsEmpty ConcurrentQueue<T>.IsEmpty ConcurrentQueue<T>.IsEmpty Property

定義

取得值,這個值指出 ConcurrentQueue<T> 是否是空的。Gets a value that indicates whether the ConcurrentQueue<T> is empty.

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

屬性值

如果 true 是空的,則為 ConcurrentQueue<T>,否則為 falsetrue if the ConcurrentQueue<T> is empty; otherwise, false.

備註

若要判斷集合是否包含任何專案, 建議使用這個屬性, 而不是從Count屬性中抓取專案數, 並將其與0進行比較。For determining whether the collection contains any items, use of this property is recommended rather than retrieving the number of items from the Count property and comparing it to 0. 不過, 因為此集合是要同時存取, 所以另一個執行緒可能會在傳回之後IsEmpty修改集合, 因而使結果失效。However, as this collection is intended to be accessed concurrently, it may be the case that another thread will modify the collection after IsEmpty returns, thus invalidating the result.

適用於

另請參閱