Show / Hide Table of Contents

Class TaskType

Provides specialized reflection methods for task types.

Inheritance
object
TaskType
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.Reflection
Assembly: DotNext.dll
Syntax
public static class TaskType

Methods

View Source

MakeTaskType(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 taskResult is void; or Task<TResult> or ValueTask<TResult> with actual generic argument equals to taskResult.

See Also
Task
Task<TResult>
ValueTask
ValueTask<TResult>
View Source

get_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 task.

View Source

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>
View Source

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
View Source

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 taskType is not a task type.

See Also

Task
Task<TResult>
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾