/// <summary>Returns the value of the specified field argument, or defaultValue if none found</summary> public static object GetArgument(this IResolveFieldContext context, Type argumentType, string name, object defaultValue = null) { bool exists = context.TryGetArgument(argumentType, name, out object result); return(exists ? result == null && argumentType.IsValueType ? defaultValue : result : defaultValue); }
/// <summary>Returns the value of the specified field argument, or defaultValue if none found</summary> public static TType GetArgument <TType>(this IResolveFieldContext context, string name, TType defaultValue = default) { bool exists = context.TryGetArgument(typeof(TType), name, out object result); return(exists ? result == null && typeof(TType).IsValueType ? defaultValue : (TType)result : defaultValue); }