Constructors: NewArgumentNullException

NewArgumentNullException

Creates a new ArgumentNullException object.



 Public Function NewArgumentNullException(
	  Optional ByRef ParamName As String,
	  Optional ByRef Message As String,
	  Optional ByVal InnerException As Exception ) As ArgumentNullException

Parameters

ParamName
[ByRef] Optional. String. The parameter that caused the exception.
Message
[ByRef] Optional. String. A human-readable message explaining the exception.
InnerException
[ByVal] Optional. Exception. An exception that caused this exception.

Return Values

ArgumentNullException -  A fully created ArgumentNullException object.

Remarks

When throwing an ArgumentNullException a meaningful error message describing the invalid argument and the name of the argument should be defined.

Examples

 ' Throws a default ArgumentNullException object
 Throw New ArgumentNullException

 ' Throws an ArgumentNullException with a custom message and parameter name
 Throw Cor.NewArgumentNullException("MyParam", "A valid object is required.")

 ' Throws an ArgumentNullException with a custom message and error code and parameter name
 Dim ex As ArgumentNullException
 Set ex = Cor.NewArgumentNullException("MyParam", "A valid object is required.")
 ex.HResult = 123
 Throw ex
 

This example shows how to throw three different variations of the same ArgumentNullException object.

See Also

Project CorLib Overview

Class Constructors Overview

ArgumentNullException