internal static void IfNullAndNullsAreIllegalThenThrow <T>(object value, ExceptionArgument argument) { if (default(T) != null) { throw new ArgumentNullException(argument.ToString()); } }
private static string GetArgumentName(ExceptionArgument argument) { Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum."); return argument.ToString(); }
public static void IfNullAndNullsAreIllegalThenThrow <T>(object value, ExceptionArgument arg) { if (!typeof(T).IsClass && value == null) { throw new ArgumentNullException(arg.ToString()); } }
private static string GetArgumentName(ExceptionArgument argument) { Debug.Assert(Enum.IsDefined(typeof(ExceptionArgument), argument), "The enum value is not defined, please check the ExceptionArgument Enum."); return(argument.ToString()); }
private static string GetArgumentName(ExceptionArgument argument) { switch (argument) { case ExceptionArgument.key: case ExceptionArgument.input: case ExceptionArgument.value: case ExceptionArgument.length: case ExceptionArgument.text: return(argument.ToString()); case ExceptionArgument.offsetLength: return("offset and length"); default: Debug.Assert(false, "The enum value is not defined, please check the ExceptionArgument Enum."); return(""); } }
private static string GetArgumentName(ExceptionArgument argument) { string name = null; switch (argument) { case ExceptionArgument.key: case ExceptionArgument.input: case ExceptionArgument.value: case ExceptionArgument.text: case ExceptionArgument.item: name = argument.ToString(); break; case ExceptionArgument.offsetLength: name = "offset and length"; break; } Debug.Assert(name != null, "The enum value is not defined, please check the ExceptionArgument Enum."); return(name); }
public static void ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionReason reason) { throw new ArgumentOutOfRangeException(argument.ToString(), GetExceptionReason(reason)); }
private static string GetArgumentName(ExceptionArgument argument) { switch (argument) { case ExceptionArgument.obj: return("obj"); case ExceptionArgument.dictionary: return("dictionary"); case ExceptionArgument.array: return("array"); case ExceptionArgument.info: return("info"); case ExceptionArgument.key: return("key"); case ExceptionArgument.text: return("text"); case ExceptionArgument.values: return("values"); case ExceptionArgument.value: return("value"); case ExceptionArgument.startIndex: return("startIndex"); case ExceptionArgument.task: return("task"); case ExceptionArgument.ch: return("ch"); case ExceptionArgument.s: return("s"); case ExceptionArgument.input: return("input"); case ExceptionArgument.list: return("list"); case ExceptionArgument.index: return("index"); case ExceptionArgument.capacity: return("capacity"); case ExceptionArgument.collection: return("collection"); case ExceptionArgument.item: return("item"); case ExceptionArgument.converter: return("converter"); case ExceptionArgument.match: return("match"); case ExceptionArgument.count: return("count"); case ExceptionArgument.action: return("action"); case ExceptionArgument.comparison: return("comparison"); case ExceptionArgument.exceptions: return("exceptions"); case ExceptionArgument.exception: return("exception"); case ExceptionArgument.enumerable: return("enumerable"); case ExceptionArgument.start: return("start"); case ExceptionArgument.format: return("format"); case ExceptionArgument.culture: return("culture"); case ExceptionArgument.comparer: return("comparer"); case ExceptionArgument.comparable: return("comparable"); case ExceptionArgument.source: return("source"); case ExceptionArgument.state: return("state"); case ExceptionArgument.length: return("length"); case ExceptionArgument.comparisonType: return("comparisonType"); case ExceptionArgument.manager: return("manager"); case ExceptionArgument.sourceBytesToCopy: return("sourceBytesToCopy"); case ExceptionArgument.callBack: return("callBack"); case ExceptionArgument.creationOptions: return("creationOptions"); case ExceptionArgument.function: return("function"); case ExceptionArgument.delay: return("delay"); case ExceptionArgument.millisecondsDelay: return("millisecondsDelay"); case ExceptionArgument.millisecondsTimeout: return("millisecondsTimeout"); case ExceptionArgument.timeout: return("timeout"); case ExceptionArgument.type: return("type"); case ExceptionArgument.sourceIndex: return("sourceIndex"); case ExceptionArgument.sourceArray: return("sourceArray"); case ExceptionArgument.destinationIndex: return("destinationIndex"); case ExceptionArgument.destinationArray: return("destinationArray"); case ExceptionArgument.other: return("other"); case ExceptionArgument.newSize: return("newSize"); case ExceptionArgument.lowerBounds: return("lowerBounds"); case ExceptionArgument.lengths: return("lengths"); case ExceptionArgument.len: return("len"); case ExceptionArgument.keys: return("keys"); case ExceptionArgument.indices: return("indices"); case ExceptionArgument.endIndex: return("endIndex"); case ExceptionArgument.elementType: return("elementType"); case ExceptionArgument.arrayIndex: return("arrayIndex"); default: Debug.Fail("The enum value is not defined, please check the ExceptionArgument Enum."); return(argument.ToString()); } }
private static Exception CreateArgumentNullException(ExceptionArgument argument) => new ArgumentNullException(argument.ToString());
public static void ThrowArgumentOutOfRangeException(ExceptionArgument arg, ExceptionResource msg) { throw new ArgumentOutOfRangeException(arg.ToString(), msg.ToString()); }
private static string GetArgumentName(ExceptionArgument argument) => argument.ToString();
private static Exception CreateArgumentNullException(ExceptionArgument argument) { return new ArgumentNullException(argument.ToString()); }
private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, string resource) { return(new ArgumentOutOfRangeException(argument.ToString(), resource)); }
private static String GetArgumentName(ExceptionArgument argument) { return(argument.ToString()); }
public static void ThrowArgumentNull(ExceptionArgument argument) => throw new ArgumentNullException(argument.ToString());
public static void ThrowArgumentNullException(ExceptionArgument arg) { throw new ArgumentNullException(arg.ToString()); }
internal static void ThrowArgumentNullException(ExceptionArgument argument) { throw new ArgumentNullException(argument.ToString()); }
internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument, string message) { throw new ArgumentOutOfRangeException(argument.ToString(), message); }
internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument) { throw new ArgumentOutOfRangeException(argument.ToString()); }
private static Exception NewObjectDisposedException(ExceptionArgument argument) => new ObjectDisposedException(argument.ToString());
/// <summary> /// </summary> /// <param name="argument"> /// The argument. /// </param> /// <param name="resource"> /// The resource. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// </exception> public static void ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) { throw new ArgumentOutOfRangeException(argument.ToString(), resource.ToString()); }
internal static void ThrowArgumentException_CannotExtractScalar(ExceptionArgument argument) { throw new ArgumentException(SR.Argument_CannotExtractScalar, argument.ToString()); }
private static Exception CreateArgumentOutOfRangeException(ExceptionArgument argument) { return(new ArgumentOutOfRangeException(argument.ToString())); }
public static void ThrowArgumentException(ExceptionArgument arg) { throw new ArgumentException("argument error", arg.ToString()); }
private static Exception CreateArgumentOutOfRangeException(ExceptionArgument argument) { return new ArgumentOutOfRangeException(argument.ToString()); }
[DoesNotReturn] public static void ThrowIfDisposed(ExceptionArgument argument) => throw new ObjectDisposedException(argument.ToString());
private static Exception NewArgumentOutOfRangeException(ExceptionArgument argument) => new ArgumentOutOfRangeException(argument.ToString());
public static void ThrowArgumentOutOfRangeException(ExceptionArgument arg) { throw new ArgumentOutOfRangeException(arg.ToString()); }
public static void ThrowArgumentOutOfRange(ExceptionArgument argument) => throw new ArgumentOutOfRangeException(argument.ToString(), SR.ArgumentOutOfRange_NeedNonNegNum);
internal static void ThrowArgumentException(string resource, ExceptionArgument argument) { throw new ArgumentException(resource, argument.ToString()); }