internal static Type GetAsyncMethodTaskReturnType(this MethodInfo method)
{
Type type = method.ReturnType;
if (IsAsync(method) && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Task<>))
{
return type.GetGenericArguments()[0];
}
return null;
}
}