Class TaskType
Provides specialized reflection methods for task types.
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.dll
Syntax
public static class TaskType
Methods
View SourceMakeTaskType(Type, bool)
Returns task type for the specified result type.
Declaration
[RequiresDynamicCode("Runtime binding requires dynamic code compilation")]
[RequiresUnreferencedCode("Dynamic code generation may be incompatible with IL trimming")]
public static Type MakeTaskType(this Type taskResult, bool valueTask = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | taskResult | Task result type. |
| bool | valueTask | true to make value task type. |
Returns
| Type | Description |
|---|---|
| Type | Returns Task or ValueTask if |
See Also
View Sourceget_IsCompletedGetter(Task)
Gets a delegate that representing getter method of IsCompleted property captured for the specified task.
Declaration
public static Func<bool> get_IsCompletedGetter(Task task)
Parameters
| Type | Name | Description |
|---|---|---|
| Task | task |
Returns
| Type | Description |
|---|---|
| Func<bool> | The delegate representing IsCompleted property of |
get_IsCompletedSuccessfullyGetter()
Gets a delegate representing getter method of IsCompletedSuccessfully property.
Declaration
public static Func<Task, bool> get_IsCompletedSuccessfullyGetter()
Returns
| Type | Description |
|---|---|
| Func<Task, bool> |
get_ResultGetter<T>()
Gets delegate representing getter of Result property.
Declaration
public static Func<Task<T>, T> get_ResultGetter<T>() where T : notnull
Returns
| Type | Description |
|---|---|
| Func<Task<T>, T> | The delegate representing Result property getter. |
Type Parameters
| Name | Description |
|---|---|
| T |
get_TaskGenericArgument(Type)
Obtains result type from task type.
Declaration
public static Type? get_TaskGenericArgument(Type taskType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | taskType |
Returns
| Type | Description |
|---|---|
| Type | Task result type; or null if |