BlockingCollection<T>.ToArray Method

.NET Framework 4.6 and 4.5

Copies the items from the BlockingCollection<T> instance into a new array.

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

public T[] ToArray()

Return Value

Type: T[]
An array containing copies of the elements of the collection.

ExceptionCondition
ObjectDisposedException

The BlockingCollection<T> has been disposed.

The copied elements are not removed from the collection.

If any method in BlockingCollection is executing while the ToArray method executes, the return value is approximate. ToArray  may include items that have already been removed, or exclude items that have already been inserted.

.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