BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.SystemException

Represents the error that occurs when an argument passed to a method is invalid.

is thrown when a method is invoked and at least one of the passed arguments does not meet the method's parameter specification.

The Base Class Library includes three derived types:

When appropriate, use these types instead of .

The following example demonstrates an error that causes a exception to be thrown by the system.

`using System; public class MyClass {} public class ArgExceptionExample { public static void Main() { MyClass my = new MyClass(); string s = "sometext"; try { int i = s.CompareTo(my); } catch (ArgumentException e) { Console.WriteLine("Error: {0}",e); } } }`

The output is

Error: System.ArgumentException: Object must be of type String.

at System.String.CompareTo(Object value)

at ArgExceptionExample.Main()

- Constructor

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance to a system-supplied message that describes the error, such as "An invalid argument was specified." This message takes into account the current system culture.

  The property is initialized to .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments. The and properties are initialized to .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  To be added.
  To be added.
  To be added.
  To be added.
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
  An instance of that is the cause of the current Exception. If is non-null, then the current Exception was raised in a catch block handling .

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance using , and the property using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments. The property is initialized to .

  For information on inner exceptions, see .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
  A that contains the name of the parameter that caused the exception.

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance using , and the property using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments. The property is initialized to .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
  A that contains the name of the parameter that caused the current exception.
  An instance of that is the cause of the current Exception. If is non-null, then the current Exception was raised in a catch block handling .

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance using , the property using , and the property using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments.

  For information on inner exceptions, see .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void `` `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.String

  Gets the error message that explains the reason for the exception.

  A containing the error message with appended, if it in not .

  This property is read-only.

  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.String

  Gets the name of the parameter that caused the current Exception.

  A that contains the name of the parameter that caused the current Exception, or if no value was specified to the constructor for the current instance.

  This property is read-only.

  The property returns the same value as was passed into the constructor.

  Override the property to customize the content or format of the parameter name.

  Use this property to retrieve the name of the invalid parameter.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
0 System.Runtime.InteropServices.ComVisible(true)