The Labs \ Source Viewer \ SSCLI \ System.ComponentModel \ InvalidEnumArgumentException

  1. //------------------------------------------------------------------------------
  2. // <copyright file="InvalidEnumArgumentException.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.ComponentModel
  16. {
  17.     using Microsoft.Win32;
  18.     using System;
  19.     using System.Diagnostics;
  20.     using System.Globalization;
  21.     using System.Runtime.Serialization;
  22.     using System.Security.Permissions;
  23.    
  24.     /// <devdoc>
  25.     /// <para>The exception that is thrown when using invalid arguments that are enumerators.</para>
  26.     /// </devdoc>
  27.     [HostProtection(SharedState = true)]
  28.     [Serializable()]
  29.     public class InvalidEnumArgumentException : ArgumentException
  30.     {
  31.        
  32.         /// <devdoc>
  33.         /// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class without a message.</para>
  34.         /// </devdoc>
  35.         public InvalidEnumArgumentException() : this(null)
  36.         {
  37.         }
  38.        
  39.         /// <devdoc>
  40.         /// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class with
  41.         /// the specified message.</para>
  42.         /// </devdoc>
  43.         public InvalidEnumArgumentException(string message) : base(message)
  44.         {
  45.         }
  46.        
  47.         /// <devdoc>
  48.         /// Initializes a new instance of the Exception class with a specified error message and a
  49.         /// reference to the inner exception that is the cause of this exception.
  50.         /// FxCop CA1032: Multiple constructors are required to correctly implement a custom exception.
  51.         /// </devdoc>
  52.         public InvalidEnumArgumentException(string message, Exception innerException) : base(message, innerException)
  53.         {
  54.         }
  55.        
  56.         /// <devdoc>
  57.         /// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class with a
  58.         /// message generated from the argument, invalid value, and enumeration
  59.         /// class.</para>
  60.         /// </devdoc>
  61.         public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass) : base(SR.GetString(SR.InvalidEnumArgument, argumentName, invalidValue.ToString(CultureInfo.CurrentCulture), enumClass.Name), argumentName)
  62.         {
  63.         }
  64.        
  65.         /// <devdoc>
  66.         /// Need this constructor since Exception implements ISerializable. We don't have any fields,
  67.         /// so just forward this to base.
  68.         /// </devdoc>
  69.         protected InvalidEnumArgumentException(SerializationInfo info, StreamingContext context) : base(info, context)
  70.         {
  71.         }
  72.     }
  73. }

Developer Fusion