So far, we have learned how data parallelism gives us the advantage of running loops in parallel on multiple cores of a system, thereby making efficient use of the available CPU resources. You should be aware that there is another important concept that you can use in order to control how many tasks you want to create in your loops. This concept is called the degree of parallelism. It's a number that specifies the maximum number of tasks that can be created by your parallel loops. You can set the degree of parallelism via a property called MaxDegreeOfParallelism, which is part of the ParallelOptions class. The following is the syntax of Parallel.For, wherein you can pass the ParallelOptions instance:
public static ParallelLoopResult For(
int fromInclusive,
int toExclusive,
ParallelOptions parallelOptions,
...