ThrowIfNull Method
Definition
ThrowIfNull<T>(IDecorator<T>, out T, string, string)
Validates and throws an ArgumentNullException if the specified argument is null.
public static void ThrowIfNull<T>(IDecorator<T> argument, out T inner, string message = "Value cannot be null.", string paramName = null)
Parameters
argumentIDecorator<T>The value to be evaluated.
innerTThe inner object of
argument.messagestringA message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Type Parameters
TThe type of the inner object denoted by
argument.
Exceptions
- ArgumentNullException
argumentcannot be null - or - Inner property ofargumentcannot be null.
ThrowIfNull(object, string, string)
Validates and throws an ArgumentNullException if the specified argument is null.
public static void ThrowIfNull(object argument, string message = "Value cannot be null.", string paramName = null)
Parameters
argumentobjectThe value to be evaluated.
messagestringA message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Exceptions
- ArgumentNullException
argumentcannot be null.