ParallelEnumerable.WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken) Método
Definição
Define o CancellationToken a associar à consulta.Sets the CancellationToken to associate with the query.
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<TSource> ^ WithCancellation(System::Linq::ParallelQuery<TSource> ^ source, System::Threading::CancellationToken cancellationToken);
public static System.Linq.ParallelQuery<TSource> WithCancellation<TSource> (this System.Linq.ParallelQuery<TSource> source, System.Threading.CancellationToken cancellationToken);
static member WithCancellation : System.Linq.ParallelQuery<'Source> * System.Threading.CancellationToken -> System.Linq.ParallelQuery<'Source>
<Extension()>
Public Function WithCancellation(Of TSource) (source As ParallelQuery(Of TSource), cancellationToken As CancellationToken) As ParallelQuery(Of TSource)
Parâmetros de tipo
- TSource
O tipo dos elementos de source.The type of elements of source.
Parâmetros
- source
- ParallelQuery<TSource>
Um ParallelQuery no qual definir a opção.A ParallelQuery on which to set the option.
- cancellationToken
- CancellationToken
Um token de cancelamento.A cancellation token.
Retornos
O ParallelQuery que representa a mesma consulta como origem, mas com o token de cancelamento registrado.ParallelQuery representing the same query as source, but with the registered cancellation token.
Exceções
O CancellationTokenSource associados ao cancellationToken foi descartado.The CancellationTokenSource associated with the cancellationToken has been disposed.
source é uma referência nula (Nada no Visual Basic).source is a null reference (Nothing in Visual Basic).
WithCancellation é usado várias vezes na consulta.WithCancellation is used multiple times in the query.