Esempio n. 1
0
        //
        // This function will convert an ExceptionResource enum value to the resource string.
        //
        internal static string GetResourceName(ExceptionResource resource)
        {
            Contract.Assert(Enum.IsDefined(typeof(ExceptionResource), resource),
                            "The enum value is not defined, please check the ExceptionResource Enum.");

            return(resource.ToString());
        }
Esempio n. 2
0
        private static string GetResourceString(ExceptionResource resource)
        {
            Debug.Assert(Enum.IsDefined(typeof(ExceptionResource), resource),
                         "The enum value is not defined, please check the ExceptionResource Enum.");

            return(SR.GetResourceString(resource.ToString()));
        }
Esempio n. 3
0
        private static string GetResourceStringInner(ExceptionResource resource)
        {
            Contract.Assert(Enum.IsDefined(typeof(ExceptionResource), resource),
                            "The enum value is not defined, please check the ExceptionResource Enum.");

            return(Environment.GetResourceString(resource.ToString()));
        }
Esempio n. 4
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());
 }
Esempio n. 5
0
 private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
 {
     return(new ArgumentOutOfRangeException(GetArgumentName(argument), resource.ToString()));
 }
Esempio n. 6
0
 private static ArgumentException GetArgumentException(ExceptionResource resource)
 {
     return(new ArgumentException(resource.ToString()));
 }
Esempio n. 7
0
 private static string GetResourceString(ExceptionResource resource)
 {
     return(resource.ToString());
     //switch (resource)
     //{
     //    case ExceptionResource.ArgumentOutOfRange_Index:
     //        return SR.ArgumentOutOfRange_Index;
     //    case ExceptionResource.ArgumentOutOfRange_Count:
     //        return SR.ArgumentOutOfRange_Count;
     //    case ExceptionResource.Arg_ArrayPlusOffTooSmall:
     //        return SR.Arg_ArrayPlusOffTooSmall;
     //    case ExceptionResource.NotSupported_ReadOnlyCollection:
     //        return SR.NotSupported_ReadOnlyCollection;
     //    case ExceptionResource.Arg_RankMultiDimNotSupported:
     //        return SR.Arg_RankMultiDimNotSupported;
     //    case ExceptionResource.Arg_NonZeroLowerBound:
     //        return SR.Arg_NonZeroLowerBound;
     //    case ExceptionResource.ArgumentOutOfRange_ListInsert:
     //        return SR.ArgumentOutOfRange_ListInsert;
     //    case ExceptionResource.ArgumentOutOfRange_NeedNonNegNum:
     //        return SR.ArgumentOutOfRange_NeedNonNegNum;
     //    case ExceptionResource.ArgumentOutOfRange_SmallCapacity:
     //        return SR.ArgumentOutOfRange_SmallCapacity;
     //    case ExceptionResource.Argument_InvalidOffLen:
     //        return SR.Argument_InvalidOffLen;
     //    case ExceptionResource.Argument_CannotExtractScalar:
     //        return SR.Argument_CannotExtractScalar;
     //    case ExceptionResource.ArgumentOutOfRange_BiggerThanCollection:
     //        return SR.ArgumentOutOfRange_BiggerThanCollection;
     //    case ExceptionResource.Serialization_MissingKeys:
     //        return SR.Serialization_MissingKeys;
     //    case ExceptionResource.Serialization_NullKey:
     //        return SR.Serialization_NullKey;
     //    case ExceptionResource.NotSupported_KeyCollectionSet:
     //        return SR.NotSupported_KeyCollectionSet;
     //    case ExceptionResource.NotSupported_ValueCollectionSet:
     //        return SR.NotSupported_ValueCollectionSet;
     //    case ExceptionResource.InvalidOperation_NullArray:
     //        return SR.InvalidOperation_NullArray;
     //    case ExceptionResource.TaskT_TransitionToFinal_AlreadyCompleted:
     //        return SR.TaskT_TransitionToFinal_AlreadyCompleted;
     //    case ExceptionResource.TaskCompletionSourceT_TrySetException_NullException:
     //        return SR.TaskCompletionSourceT_TrySetException_NullException;
     //    case ExceptionResource.TaskCompletionSourceT_TrySetException_NoExceptions:
     //        return SR.TaskCompletionSourceT_TrySetException_NoExceptions;
     //    case ExceptionResource.NotSupported_StringComparison:
     //        return SR.NotSupported_StringComparison;
     //    case ExceptionResource.ConcurrentCollection_SyncRoot_NotSupported:
     //        return SR.ConcurrentCollection_SyncRoot_NotSupported;
     //    case ExceptionResource.Task_MultiTaskContinuation_NullTask:
     //        return SR.Task_MultiTaskContinuation_NullTask;
     //    case ExceptionResource.InvalidOperation_WrongAsyncResultOrEndCalledMultiple:
     //        return SR.InvalidOperation_WrongAsyncResultOrEndCalledMultiple;
     //    case ExceptionResource.Task_MultiTaskContinuation_EmptyTaskList:
     //        return SR.Task_MultiTaskContinuation_EmptyTaskList;
     //    case ExceptionResource.Task_Start_TaskCompleted:
     //        return SR.Task_Start_TaskCompleted;
     //    case ExceptionResource.Task_Start_Promise:
     //        return SR.Task_Start_Promise;
     //    case ExceptionResource.Task_Start_ContinuationTask:
     //        return SR.Task_Start_ContinuationTask;
     //    case ExceptionResource.Task_Start_AlreadyStarted:
     //        return SR.Task_Start_AlreadyStarted;
     //    case ExceptionResource.Task_RunSynchronously_Continuation:
     //        return SR.Task_RunSynchronously_Continuation;
     //    case ExceptionResource.Task_RunSynchronously_Promise:
     //        return SR.Task_RunSynchronously_Promise;
     //    case ExceptionResource.Task_RunSynchronously_TaskCompleted:
     //        return SR.Task_RunSynchronously_TaskCompleted;
     //    case ExceptionResource.Task_RunSynchronously_AlreadyStarted:
     //        return SR.Task_RunSynchronously_AlreadyStarted;
     //    case ExceptionResource.AsyncMethodBuilder_InstanceNotInitialized:
     //        return SR.AsyncMethodBuilder_InstanceNotInitialized;
     //    case ExceptionResource.Task_ContinueWith_ESandLR:
     //        return SR.Task_ContinueWith_ESandLR;
     //    case ExceptionResource.Task_ContinueWith_NotOnAnything:
     //        return SR.Task_ContinueWith_NotOnAnything;
     //    case ExceptionResource.Task_Delay_InvalidDelay:
     //        return SR.Task_Delay_InvalidDelay;
     //    case ExceptionResource.Task_Delay_InvalidMillisecondsDelay:
     //        return SR.Task_Delay_InvalidMillisecondsDelay;
     //    case ExceptionResource.Task_Dispose_NotCompleted:
     //        return SR.Task_Dispose_NotCompleted;
     //    case ExceptionResource.Task_ThrowIfDisposed:
     //        return SR.Task_ThrowIfDisposed;
     //    case ExceptionResource.Task_WaitMulti_NullTask:
     //        return SR.Task_WaitMulti_NullTask;
     //    case ExceptionResource.ArgumentException_OtherNotArrayOfCorrectLength:
     //        return SR.ArgumentException_OtherNotArrayOfCorrectLength;
     //    case ExceptionResource.ArgumentNull_SafeHandle:
     //        return SR.ArgumentNull_SafeHandle;
     //    case ExceptionResource.ArgumentOutOfRange_EndIndexStartIndex:
     //        return SR.ArgumentOutOfRange_EndIndexStartIndex;
     //    case ExceptionResource.ArgumentOutOfRange_Enum:
     //        return SR.ArgumentOutOfRange_Enum;
     //    case ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported:
     //        return SR.ArgumentOutOfRange_HugeArrayNotSupported;
     //    case ExceptionResource.Argument_AddingDuplicate:
     //        return SR.Argument_AddingDuplicate;
     //    case ExceptionResource.Argument_InvalidArgumentForComparison:
     //        return SR.Argument_InvalidArgumentForComparison;
     //    case ExceptionResource.Arg_LowerBoundsMustMatch:
     //        return SR.Arg_LowerBoundsMustMatch;
     //    case ExceptionResource.Arg_MustBeType:
     //        return SR.Arg_MustBeType;
     //    case ExceptionResource.Arg_Need1DArray:
     //        return SR.Arg_Need1DArray;
     //    case ExceptionResource.Arg_Need2DArray:
     //        return SR.Arg_Need2DArray;
     //    case ExceptionResource.Arg_Need3DArray:
     //        return SR.Arg_Need3DArray;
     //    case ExceptionResource.Arg_NeedAtLeast1Rank:
     //        return SR.Arg_NeedAtLeast1Rank;
     //    case ExceptionResource.Arg_RankIndices:
     //        return SR.Arg_RankIndices;
     //    case ExceptionResource.Arg_RanksAndBounds:
     //        return SR.Arg_RanksAndBounds;
     //    case ExceptionResource.InvalidOperation_IComparerFailed:
     //        return SR.InvalidOperation_IComparerFailed;
     //    case ExceptionResource.NotSupported_FixedSizeCollection:
     //        return SR.NotSupported_FixedSizeCollection;
     //    case ExceptionResource.Rank_MultiDimNotSupported:
     //        return SR.Rank_MultiDimNotSupported;
     //    case ExceptionResource.Arg_TypeNotSupported:
     //        return SR.Arg_TypeNotSupported;
     //    default:
     //        Debug.Assert(false,
     //            "The enum value is not defined, please check the ExceptionResource Enum.");
     //        return "";
     //}
 }
Esempio n. 8
0
 public static void ThrowInvalidOperationException(ExceptionResource msg)
 {
     throw new InvalidOperationException(msg.ToString());
 }
Esempio n. 9
0
 public static void ThrowArgumentException(ExceptionResource msg)
 {
     throw new ArgumentException(msg.ToString());
 }
Esempio n. 10
0
 public static void ThrowArgumentOutOfRangeException(ExceptionArgument arg, ExceptionResource msg)
 {
     throw new ArgumentOutOfRangeException(arg.ToString(), msg.ToString());
 }
Esempio n. 11
0
 public static void ThrowNotSupportedException(ExceptionResource msg)
 {
     throw new NotSupportedException(msg.ToString());
 }