예제 #1
0
 internal static void IfNullAndNullsAreIllegalThenThrow <T>(object value, ExceptionArgument argument)
 {
     if (default(T) != null)
     {
         throw new ArgumentNullException(argument.ToString());
     }
 }
예제 #2
0
        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();
        }
예제 #3
0
 public static void IfNullAndNullsAreIllegalThenThrow <T>(object value, ExceptionArgument arg)
 {
     if (!typeof(T).IsClass && value == null)
     {
         throw new ArgumentNullException(arg.ToString());
     }
 }
예제 #4
0
        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());
        }
예제 #5
0
        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("");
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
 public static void ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionReason reason)
 {
     throw new ArgumentOutOfRangeException(argument.ToString(), GetExceptionReason(reason));
 }
예제 #8
0
        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());
            }
        }
예제 #9
0
 private static Exception CreateArgumentNullException(ExceptionArgument argument) => new ArgumentNullException(argument.ToString());
예제 #10
0
 public static void ThrowArgumentOutOfRangeException(ExceptionArgument arg, ExceptionResource msg)
 {
     throw new ArgumentOutOfRangeException(arg.ToString(), msg.ToString());
 }
예제 #11
0
 private static string GetArgumentName(ExceptionArgument argument) => argument.ToString();
예제 #12
0
파일: ThrowHelper.cs 프로젝트: rahku/corefx
 private static Exception CreateArgumentNullException(ExceptionArgument argument) { return new ArgumentNullException(argument.ToString()); }
예제 #13
0
 private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, string resource)
 {
     return(new ArgumentOutOfRangeException(argument.ToString(), resource));
 }
예제 #14
0
 private static String GetArgumentName(ExceptionArgument argument)
 {
     return(argument.ToString());
 }
예제 #15
0
 public static void ThrowArgumentNull(ExceptionArgument argument) => throw new ArgumentNullException(argument.ToString());
예제 #16
0
 public static void ThrowArgumentNullException(ExceptionArgument arg)
 {
     throw new ArgumentNullException(arg.ToString());
 }
예제 #17
0
 internal static void ThrowArgumentNullException(ExceptionArgument argument)
 {
     throw new ArgumentNullException(argument.ToString());
 }
예제 #18
0
 internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument, string message)
 {
     throw new ArgumentOutOfRangeException(argument.ToString(), message);
 }
예제 #19
0
 internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument)
 {
     throw new ArgumentOutOfRangeException(argument.ToString());
 }
예제 #20
0
 private static Exception NewObjectDisposedException(ExceptionArgument argument)
 => new ObjectDisposedException(argument.ToString());
예제 #21
0
 /// <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());
 }
예제 #22
0
 internal static void ThrowArgumentException_CannotExtractScalar(ExceptionArgument argument)
 {
     throw new ArgumentException(SR.Argument_CannotExtractScalar, argument.ToString());
 }
예제 #23
0
 private static Exception CreateArgumentOutOfRangeException(ExceptionArgument argument)
 {
     return(new ArgumentOutOfRangeException(argument.ToString()));
 }
예제 #24
0
 public static void ThrowArgumentException(ExceptionArgument arg)
 {
     throw new ArgumentException("argument error", arg.ToString());
 }
예제 #25
0
파일: ThrowHelper.cs 프로젝트: rahku/corefx
 private static Exception CreateArgumentOutOfRangeException(ExceptionArgument argument) { return new ArgumentOutOfRangeException(argument.ToString()); }
예제 #26
0
 [DoesNotReturn] public static void ThrowIfDisposed(ExceptionArgument argument) => throw new ObjectDisposedException(argument.ToString());
예제 #27
0
파일: ThrowHelper.cs 프로젝트: tmds/IoUring
 private static Exception NewArgumentOutOfRangeException(ExceptionArgument argument)
 => new ArgumentOutOfRangeException(argument.ToString());
예제 #28
0
 public static void ThrowArgumentOutOfRangeException(ExceptionArgument arg)
 {
     throw new ArgumentOutOfRangeException(arg.ToString());
 }
예제 #29
0
 public static void ThrowArgumentOutOfRange(ExceptionArgument argument) => throw new ArgumentOutOfRangeException(argument.ToString(), SR.ArgumentOutOfRange_NeedNonNegNum);
예제 #30
0
 internal static void ThrowArgumentException(string resource, ExceptionArgument argument)
 {
     throw new ArgumentException(resource, argument.ToString());
 }