Class Conversion
Provides task result conversion methods.
Namespace: DotNext.Threading.Tasks
Assembly: DotNext.dll
Syntax
public static class Conversion : object
Methods
| Improve this Doc View SourceConvert<I, O>(Task<I>)
Converts one type of task into another.
Declaration
public static Task<O> Convert<I, O>(this Task<I> task)
where I : O
Parameters
Type | Name | Description |
---|---|---|
Task<I> | task | The task to convert. |
Returns
Type | Description |
---|---|
Task<O> | The converted task. |
Type Parameters
Name | Description |
---|---|
I | The source task type. |
O | The target task type. |
Convert<I, O>(Task<I>, Converter<I, O>)
Converts one type of task into another.
Declaration
public static Task<O> Convert<I, O>(this Task<I> task, Converter<I, O> converter)
Parameters
Type | Name | Description |
---|---|---|
Task<I> | task | The task to convert. |
DotNext.Converter<I, O> | converter | Non-blocking conversion function. |
Returns
Type | Description |
---|---|
Task<O> | The converted task. |
Type Parameters
Name | Description |
---|---|
I | The source task type. |
O | The target task type. |
Convert<I, O>(Task<I>, Converter<I, Task<O>>)
Converts one type of task into another.
Declaration
public static Task<O> Convert<I, O>(this Task<I> task, Converter<I, Task<O>> converter)
Parameters
Type | Name | Description |
---|---|---|
Task<I> | task | The task to convert. |
DotNext.Converter<I, Task<O>> | converter | Asynchronous conversion function. |
Returns
Type | Description |
---|---|
Task<O> | The converted task. |
Type Parameters
Name | Description |
---|---|
I | The source task type. |
O | The target task type. |
ToNullable<T>(Task<T>)
Converts value type into nullable value type.
Declaration
public static Task<T?> ToNullable<T>(this Task<T> task)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
Task<T> | task | The task to convert. |
Returns
Type | Description |
---|---|
Task<Nullable<T>> | The converted task. |
Type Parameters
Name | Description |
---|---|
T | The value type. |