Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ConcurrentStack<T>.IsEmpty Property

.NET Framework 4.6 and 4.5

Gets a value that indicates whether the ConcurrentStack<T> is empty.

Namespace:  System.Collections.Concurrent
Assemblies:   System.Collections.Concurrent (in System.Collections.Concurrent.dll)
  mscorlib (in mscorlib.dll)

public bool IsEmpty { get; }

Property Value

Type: System.Boolean
true if the ConcurrentStack<T> is empty; otherwise, false.

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. 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.

For a code example, see ConcurrentStack<T>.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft