The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
ParallelEnumerable::WithCancellation<TSource> Method (ParallelQuery<TSource>^, CancellationToken)
.NET Framework (current version)
Sets the CancellationToken to associate with the query.
Assembly: System.Core (in System.Core.dll)
public: generic<typename TSource> [ExtensionAttribute] static ParallelQuery<TSource>^ WithCancellation( ParallelQuery<TSource>^ source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq::ParallelQuery<TSource>^
A ParallelQuery on which to set the option.
- cancellationToken
-
Type:
System.Threading::CancellationToken
A cancellation token.
Return Value
Type: System.Linq::ParallelQuery<TSource>^ParallelQuery representing the same query as source, but with the registered cancellation token.
Type Parameters
- TSource
The type of elements of source.
| Exception | Condition |
|---|---|
| ObjectDisposedException | The CancellationTokenSource associated with the cancellationToken has been disposed. |
| ArgumentNullException | source is a null reference (Nothing in Visual Basic). |
| InvalidOperationException | WithCancellation is used multiple times in the query. |
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: