ConcurrentBag<T>.Count Property

Gets the number of elements contained in the ConcurrentBag<T>.

Namespace:  System.Collections.Concurrent
Assembly:  System (in System.dll)

public int Count { get; }

Property Value

Type: System.Int32
The number of elements contained in the ConcurrentBag<T>.

Implements

ICollection.Count
IReadOnlyCollection<T>.Count

The count returned represents a moment-in-time snapshot of the contents of the bag. It is possible that other threads might add or remove items immediately after you access the Count property.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft