MaxDegreeOfParallelism Property

Task Parallel System.Threading

Gets or sets the maximum degree of parallelism enabled by this ParallelOptions instance.

Namespace:  System.Threading.Tasks
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Property MaxDegreeOfParallelism As Integer
C#
public int MaxDegreeOfParallelism { get; set; }

Remarks

The MaxDegreeOfParallelism limits the number of concurrent operations run by Parallel method calls that are passed this ParallelOptions instance to the set value, if it is positive. If MaxDegreeOfParallelism is -1, then there is no limit placed on the number of concurrently running operations.

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeException The exception that is thrown when this MaxDegreeOfParallelism is set to 0 or some value less than -1.

See Also