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.ArgumentException System.Runtime.InteropServices.ComVisible(true)

The following example demonstrates an error that causes the class to throw a exception.

`using System; class ArgumentNullTest { public static void Main() { String[] s = null; String sep = " "; try { String j = String.Join(sep,s); } catch (ArgumentNullException e) { Console.WriteLine("Error: {0}",e); } } }`

The output is

Error: System.ArgumentNullException: Value cannot be null.

Parameter name: value

at System.String.Join(String separator, String[] value)

at ArgumentNullTest.Main()

ArgumentNullException is thrown when a method is invoked and at least one of the passed arguments is null but should never be null.

ArgumentNullException behaves identically to . It is provided so that application code can differentiate between exceptions caused by null arguments and exceptions caused by arguments that are not null. For errors caused by arguments that are not null, see .

uses the HRESULT E_POINTER, which has the value 0x80004003.

For a list of initial property values for an instance of , see the constructors.

The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor initializes the property of the new instance to a system-supplied message that describes the error, such as "Argument cannot be null." This message takes into account the current system culture.

  The following table shows the initial property values for an instance of .

  Property

  Value

  A null reference (Nothing in Visual Basic).

  The localized error message string.

  Initializes a new instance of the class.

  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor initializes the property of the new instance to a system-supplied message that describes the error, such as "Argument cannot be null." This message takes into account the current system culture.

  This constructor initializes the property of the new instance using the parameter. The content of is intended to be understood by humans.

  The following table shows the initial property values for an instance of .

  Property

  Value

  A null reference (Nothing in Visual Basic).

  The empty string ("").

  The parameter name string.

  Initializes a new instance of the class with the name of the parameter that causes this exception.

  The name of the parameter that caused the exception.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. For more information, see [<topic://cpconSerialization>].

  Initializes a new instance of the class with serialized data.

  The object that holds the serialized object data.
  An object that describes the source or destination of the serialized data.
- Constructor
  2.0.0.0
  4.0.0.0
  To be added.

  Initializes a new instance of the class with a specified error message and the exception that is the cause of this exception.

  The error message that explains the reason for this exception.
  The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  This constructor initializes the property of the new instance using the value of the parameter. The content of the parameter 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.

  This constructor initializes the property of the new instance using the parameter. The content of is intended to be understood by humans.

  The following table shows the initial property values for an instance of .

  Property

  Value

  A null reference (Nothing in Visual Basic).

  The error message string.

  The parameter name string.

  Initializes an instance of the class with a specified error message and the name of the parameter that causes this exception.

  The name of the parameter that caused the exception.
  A message that describes the error.
  0
0