Show / Hide Table of Contents

# CancellationTokenExtensions Class

###### Namespace: Cysharp.Threading.Tasks

###### Assembly: cs.temp.dll.dll

    public static class CancellationTokenExtensions

##### Inheritance

System.Object → CancellationTokenExtensions

### Members

#### Methods

Name | Description
--- | ---
AddTo(IDisposable, CancellationToken) |
RegisterWithoutCaptureExecutionContext(CancellationToken, Action) |
RegisterWithoutCaptureExecutionContext(CancellationToken, Action<Object>, Object) |
ToCancellationToken(UniTask) |
ToCancellationToken(UniTask, CancellationToken) |
ToCancellationToken<T>(UniTask<T>) |
ToCancellationToken<T>(UniTask<T>, CancellationToken) |
ToUniTask(CancellationToken) |
WaitUntilCanceled(CancellationToken) |

### Methods

#### AddTo(IDisposable, CancellationToken)

    public static CancellationTokenRegistration AddTo(this IDisposable disposable, CancellationToken cancellationToken)

##### Parameters

`disposable` System.IDisposable
`cancellationToken` CancellationToken

##### Returns

CancellationTokenRegistration

#### RegisterWithoutCaptureExecutionContext(CancellationToken, Action)

    public static CancellationTokenRegistration RegisterWithoutCaptureExecutionContext(this CancellationToken cancellationToken, Action callback)

##### Parameters

`cancellationToken` CancellationToken
`callback` System.Action

##### Returns

CancellationTokenRegistration

#### RegisterWithoutCaptureExecutionContext(CancellationToken, Action<Object>, Object)

    public static CancellationTokenRegistration RegisterWithoutCaptureExecutionContext(this CancellationToken cancellationToken, Action<object> callback, object state)

##### Parameters

`cancellationToken` CancellationToken
`callback` System.Action<System.Object>
`state` System.Object

##### Returns

CancellationTokenRegistration

#### ToCancellationToken(UniTask)

    public static CancellationToken ToCancellationToken(this UniTask task)

##### Parameters

`task` UniTask

##### Returns

CancellationToken

#### ToCancellationToken(UniTask, CancellationToken)

    public static CancellationToken ToCancellationToken(this UniTask task, CancellationToken linkToken)

##### Parameters

`task` UniTask
`linkToken` CancellationToken

##### Returns

CancellationToken

#### ToCancellationToken<T>(UniTask<T>)

    public static CancellationToken ToCancellationToken<T>(this UniTask<T> task)

##### Parameters

`task` UniTask<T>

##### Returns

CancellationToken

##### Type Parameters

`T`

#### ToCancellationToken<T>(UniTask<T>, CancellationToken)

    public static CancellationToken ToCancellationToken<T>(this UniTask<T> task, CancellationToken linkToken)

##### Parameters

`task` UniTask<T>
`linkToken` CancellationToken

##### Returns

CancellationToken

##### Type Parameters

`T`

#### ToUniTask(CancellationToken)

    public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cancellationToken)

##### Parameters

`cancellationToken` CancellationToken

##### Returns

System.ValueTuple<UniTask, CancellationTokenRegistration>

#### WaitUntilCanceled(CancellationToken)

    public static CancellationTokenAwaitable WaitUntilCanceled(this CancellationToken cancellationToken)

##### Parameters

`cancellationToken` CancellationToken

##### Returns

CancellationTokenAwaitable