Show / Hide Table of Contents

# UniTask<T> Struct

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

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

Lightweight unity specified task-like object.

    public struct UniTask<T>

#### Type Parameters

`T`

### Members

#### Constructors

Name | Description
--- | ---
UniTask(T) |
UniTask(IUniTaskSource<T>, Int16) |

#### Properties

Name | Description
--- | ---
Status |

#### Methods

Name | Description
--- | ---
AsUniTask() |
GetAwaiter() |
Preserve() | Memoizing inner IValueTaskSource. The result UniTask can await multiple.
SuppressCancellationThrow() | returns (bool IsCanceled, T Result) instead of throws OperationCanceledException.
ToString() |

#### Operators

Name | Description
--- | ---
Implicit(UniTask<T> to UniTask) |
Implicit(UniTask<T> to ValueTask<T>) |

### Constructors

#### UniTask(T)

    public UniTask(T result)

##### Parameters

`result` T

#### UniTask(IUniTaskSource<T>, Int16)

    public UniTask(IUniTaskSource<T> source, short token)

##### Parameters

`source` IUniTaskSource<T>
`token` System.Int16

### Properties

#### Status

    public UniTaskStatus Status { get; }

##### Property Value

UniTaskStatus

### Methods

#### AsUniTask()

    public UniTask AsUniTask()

##### Returns

UniTask

#### GetAwaiter()

    public UniTask<T>.Awaiter GetAwaiter()

##### Returns

UniTask.Awaiter<>

#### Preserve()

Memoizing inner IValueTaskSource. The result UniTask can await multiple.

    public UniTask<T> Preserve()

##### Returns

UniTask<T>

#### SuppressCancellationThrow()

returns (bool IsCanceled, T Result) instead of throws OperationCanceledException.

    public UniTask<(bool IsCanceled, T Result)> SuppressCancellationThrow()

##### Returns

UniTask<System.ValueTuple<System.Boolean, T>>

#### ToString()

    public override string ToString()

##### Returns

System.String

##### Overrides

System.ValueType.ToString()

### Operators

#### Implicit(UniTask<T> to UniTask)

    public static implicit operator UniTask(UniTask<T> self)

##### Parameters

`self` UniTask<T>

##### Returns

UniTask

#### Implicit(UniTask<T> to ValueTask<T>)

    public static implicit operator ValueTask<T>(in UniTask<T> self)

##### Parameters

`self` UniTask<T>

##### Returns

System.Threading.Tasks.ValueTask<T>