ParallelEnumerable.WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken) 메서드

정의

쿼리와 연결할 CancellationToken을 설정합니다.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)

형식 매개 변수

TSource

source의 요소 형식입니다.The type of elements of source.

매개 변수

source
ParallelQuery<TSource>

옵션을 설정할 ParallelQuery입니다.A ParallelQuery on which to set the option.

cancellationToken
CancellationToken

취소 토큰입니다.A cancellation token.

반환

소스와 같은 쿼리를 나타내고 등록된 취소 토큰을 포함하는 ParallelQuery입니다.ParallelQuery representing the same query as source, but with the registered cancellation token.

예외

CancellationTokenSource과 연결된 cancellationToken는 삭제되었습니다.The CancellationTokenSource associated with the cancellationToken has been disposed.

source가 null 참조(Visual Basic의 경우 Nothing)인 경우source is a null reference (Nothing in Visual Basic).

WithCancellation은 쿼리에서 여러 번 사용됩니다.WithCancellation is used multiple times in the query.

적용 대상

추가 정보