Show / Hide Table of Contents

# UniTaskCompletionSource<T> Class

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

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

    public class UniTaskCompletionSource<T> : IUniTaskSource<T>, IUniTaskSource, IValueTaskSource, IValueTaskSource<T>, IPromise<T>, IResolvePromise<T>, IRejectPromise, ICancelPromise

##### Inheritance

System.Object → UniTaskCompletionSource<T>

##### Implements

IUniTaskSource<T>
IUniTaskSource
System.Threading.Tasks.Sources.IValueTaskSource
System.Threading.Tasks.Sources.IValueTaskSource<T>
IPromise<T>
IResolvePromise<T>
IRejectPromise
ICancelPromise

#### Type Parameters

`T`

### Members

#### Constructors

Name | Description
--- | ---
UniTaskCompletionSource() |

#### Properties

Name | Description
--- | ---
Task |

#### Methods

Name | Description
--- | ---
GetResult(Int16) |
GetStatus(Int16) |
OnCompleted(Action<Object>, Object, Int16) |
TrySetCanceled(CancellationToken) |
TrySetException(Exception) |
TrySetResult(T) |
UnsafeGetStatus() |

#### Explicit Interface Implementations

Name | Description
--- | ---
IUniTaskSource.GetResult(Int16) |

### Constructors

#### UniTaskCompletionSource()

    public UniTaskCompletionSource()

### Properties

#### Task

    public UniTask<T> Task { get; }

##### Property Value

UniTask<T>

### Methods

#### GetResult(Int16)

    public T GetResult(short token)

##### Parameters

`token` System.Int16

##### Returns

T

#### GetStatus(Int16)

    public UniTaskStatus GetStatus(short token)

##### Parameters

`token` System.Int16

##### Returns

UniTaskStatus

#### OnCompleted(Action<Object>, Object, Int16)

    public void OnCompleted(Action<object> continuation, object state, short token)

##### Parameters

`continuation` System.Action<System.Object>
`state` System.Object
`token` System.Int16

#### TrySetCanceled(CancellationToken)

    public bool TrySetCanceled(CancellationToken cancellationToken = null)

##### Parameters

`cancellationToken` CancellationToken

##### Returns

System.Boolean

#### TrySetException(Exception)

    public bool TrySetException(Exception exception)

##### Parameters

`exception` System.Exception

##### Returns

System.Boolean

#### TrySetResult(T)

    public bool TrySetResult(T result)

##### Parameters

`result` T

##### Returns

System.Boolean

#### UnsafeGetStatus()

    public UniTaskStatus UnsafeGetStatus()

##### Returns

UniTaskStatus

### Explicit Interface Implementations

#### IUniTaskSource.GetResult(Int16)

    void IUniTaskSource.GetResult(short token)

##### Parameters

`token` System.Int16

### Implements

IUniTaskSource<T>
IUniTaskSource
System.Threading.Tasks.Sources.IValueTaskSource
System.Threading.Tasks.Sources.IValueTaskSource<TResult>
IPromise<T>
IResolvePromise<T>
IRejectPromise
ICancelPromise