class · System.Threading.Tasks
Task<T>
public class Task<T> : Task
A task with a value: what an async function that returns one gives.
- Kind
- class
- Namespace
- System.Threading.Tasks
- Assembly
- System.Core
- Access
- public
- Source file
Tasks.ant
Type parameters
| Name | Constraints |
|---|---|
T | any type |
Inheritance
Properties
T Result { get; }
#
The value, once done (runs the scheduler until then; throws the error if it failed).
Methods
SetResult(T value)
#
Done with value.
GetResult() : T
#
What await gives once the task has finished: its value (or its error, thrown).
A task done with value.
Fields
T result
#
Inherited members (24)
Completemethod from TaskFailmethod from TaskRunmethod from TaskPausemethod from TaskAddWaitermethod from TaskAddWaiterLockedmethod from TaskFinishmethod from TaskWakemethod from TaskWaitmethod from TaskCheckmethod from TaskDelaymethod from TaskYieldmethod from TaskDonemethod from TaskWhenAllmethod from TaskRunmethod from TaskRunmethod from TaskIsCompletedproperty from TaskIsFaultedproperty from TaskCompletedTaskproperty from TaskGetTypemethod from AnyUndescribedmethod from AnyToStringmethod from AnyHashmethod from Anydestroymethod from Any
Source
Task<T> as Antril, decompiled from its Larva HIR.
// System.Threading.Tasks.Task — System.Core (decompiled from Larva HIR)
into namespace System.Threading.Tasks
{
/// A task with a value: what an async function that returns one gives.
public class Task<T> : Task
{
inherited:
T result;
public:
/// Done with `value`.
SetResult(T value)
{
result = value;
Complete();
}
/// What `await` gives once the task has finished: its value (or its error, thrown).
GetResult() : T
{
Check();
return result;
}
/// A task done with `value`.
static FromResult(T value) : Task<T>
{
Task<T> task = new Task<T>();
task.SetResult(value);
return task;
}
/// The value, once done (runs the scheduler until then; throws the error if it failed).
T Result
{
get
{
Wait();
return result;
}
}
}
}