ParallelEnumerable.AsParallel<TSource> Method (Partitioner<TSource>)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Enables parallelization of a query, as sourced by a custom partitioner that is responsible for splitting the input sequence into partitions.

Namespace:   System.Linq
Assembly:  System.Core (in System.Core.dll)

public static ParallelQuery<TSource> AsParallel<TSource>(
	this Partitioner<TSource> source


Type: System.Collections.Concurrent.Partitioner<TSource>

A partitioner over the input sequence.

Return Value

Type: System.Linq.ParallelQuery<TSource>

The source as a ParallelQuery to bind to ParallelEnumerable extension methods.

Type Parameters


The type of elements of source.

Exception Condition

source is a null reference (Nothing in Visual Basic).

The source partitioner's GetOrderedPartitions method is used when ordering is enabled, whereas the partitioner's GetPartitions is used if ordering is not enabled (the default). The source partitioner's GetDynamicPartitions and GetDynamicOrderedPartitions are not used. For more information and examples, see Custom Partitioners for PLINQ and TPL.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top