ParallelEnumerable.WithDegreeOfParallelism(ParallelQuery<TSource>, Int32) ParallelEnumerable.WithDegreeOfParallelism(ParallelQuery<TSource>, Int32) ParallelEnumerable.WithDegreeOfParallelism(ParallelQuery<TSource>, Int32) ParallelEnumerable.WithDegreeOfParallelism(ParallelQuery<TSource>, Int32) Method

Definition

Sets the degree of parallelism to use in a query. Degree of parallelism is the maximum number of concurrently executing tasks that will be used to process the query.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TSource> ^ WithDegreeOfParallelism(System::Linq::ParallelQuery<TSource> ^ source, int degreeOfParallelism);
public static System.Linq.ParallelQuery<TSource> WithDegreeOfParallelism<TSource> (this System.Linq.ParallelQuery<TSource> source, int degreeOfParallelism);
static member WithDegreeOfParallelism : System.Linq.ParallelQuery<'Source> * int -> System.Linq.ParallelQuery<'Source>
<Extension()>
Public Function WithDegreeOfParallelism(Of TSource) (source As ParallelQuery(Of TSource), degreeOfParallelism As Integer) As ParallelQuery(Of TSource)

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource> ParallelQuery<TSource> ParallelQuery<TSource> ParallelQuery<TSource>

A ParallelQuery on which to set the limit on the degrees of parallelism.

degreeOfParallelism
Int32 Int32 Int32 Int32

The degree of parallelism for the query. The default value is Math.Min(ProcessorCount, MAX_SUPPORTED_DOP) where MAX_SUPPORTED_DOP is 512.

Returns

ParallelQuery representing the same query as source, with the limit on the degrees of parallelism set.

Exceptions

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

Applies to

See also