Class ArgumentNullException
- Namespace
- System
- Assembly
- mscorlib.dll
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.
public class ArgumentNullException : ArgumentException
- Inheritance
-
ArgumentNullException
- Inherited Members
- Extension Methods
Constructors
ArgumentNullException()
Initializes a new instance of the ArgumentNullException class.
public ArgumentNullException()
ArgumentNullException(string?)
Initializes a new instance of the ArgumentNullException class with the name of the parameter that causes this exception.
public ArgumentNullException(string? paramName)
Parameters
paramName
stringThe name of the parameter that caused the exception.
ArgumentNullException(string?, Exception?)
Initializes a new instance of the ArgumentNullException class with a specified error message and the exception that is the cause of this exception.
public ArgumentNullException(string? message, Exception? innerException)
Parameters
message
stringThe error message that explains the reason for this exception.
innerException
ExceptionThe exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
ArgumentNullException(string?, string?)
Initializes an instance of the ArgumentNullException class with a specified error message and the name of the parameter that causes this exception.
public ArgumentNullException(string? paramName, string? message)
Parameters
paramName
stringThe name of the parameter that caused the exception.
message
stringThe error message that explains the reason for this exception.
Methods
ThrowIfNull(object?, string?)
Throws an ArgumentNullException if argument
is null.
public static void ThrowIfNull(object? argument, string? paramName = null)