Constructors: NewArgumentNullException

NewArgumentNullException

Creates a new ArgumentNullException object.



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

Parameters

Message
[ByVal] String. A human-readable message explaining the exception.
ParamName
[ByVal] Optional. String. The parameter that caused 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.

Example

 ' Throws a default ArgumentNullException object
 Throw New ArgumentNullException

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

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

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

See Also

Project VBCorLib Overview Class Constructors Overview Constructors Properties Constructors Methods NewArgumentException NewArgumentOutOfRangeException ArgumentNullException