Class MethodExtensions
- Namespace
- Cratis.Reflection
- Assembly
- Cratis.Fundamentals.dll
Provides a set of methods for working with methods, such as MethodInfo.
public static class MethodExtensions
- Inheritance
-
MethodExtensions
- Inherited Members
Methods
GetActualReturnType(MethodInfo)
Get the actual return type of a method. If the method is async, it will unwrap the type from the task.
public static Type GetActualReturnType(this MethodInfo methodInfo)
Parameters
methodInfoMethodInfoMethod to get for.
Returns
- Type
The actual type.
HasAttribute<T>(MethodInfo)
Check if a method has an attribute associated with it.
public static bool HasAttribute<T>(this MethodInfo methodInfo) where T : Attribute
Parameters
methodInfoMethodInfoMethod to check.
Returns
- bool
True if there is an attribute, false if not.
Type Parameters
TAttribute type to check for.
IsAsync(MethodInfo)
Check whether or not a MethodInfo is async or not.
public static bool IsAsync(this MethodInfo methodInfo)
Parameters
methodInfoMethodInfoMethodInfo to check.
Returns
- bool
True if is async, false if not.