ParallelEnumerable.WithExecutionMode<TSource> Method (ParallelQuery<TSource>, ParallelExecutionMode)
.NET Framework (current version)
Sets the execution mode of the query.
Assembly: System.Core (in System.Core.dll)
public static ParallelQuery<TSource> WithExecutionMode<TSource>( this ParallelQuery<TSource> source, ParallelExecutionMode executionMode )
Parameters
- source
-
Type:
System.Linq.ParallelQuery<TSource>
A ParallelQuery on which to set the option.
- executionMode
-
Type:
System.Linq.ParallelExecutionMode
The mode in which to execute the query.
Return Value
Type: System.Linq.ParallelQuery<TSource>ParallelQuery representing the same query as source, but with the registered execution mode.
Type Parameters
- TSource
The type of elements of source.
| Exception | Condition |
|---|---|
| ArgumentNullException | source is a null reference (Nothing in Visual Basic). |
| ArgumentException | executionMode is not a valid ParallelExecutionMode value. |
| InvalidOperationException | WithExecutionMode is used multiple times in the query. |
The execution mode specifies whether PLINQ will attempt to fall back to sequential execution if it detects certain query shapes. For more information and examples, see How to: Specify the Execution Mode in PLINQ.
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
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Show: