Udostępnij za pośrednictwem


Throw.IfArgumentNull<T>(T, String, String) Method

Definition

Throws ArgumentNullException with the given parameter name and optional message if the given reference is null.

public static void IfArgumentNull<T> (T value, string paramName, string message = default) where T : class;
static member IfArgumentNull : 'T * string * string -> unit (requires 'T : null)
Public Shared Sub IfArgumentNull(Of T As Class) (value As T, paramName As String, Optional message As String = Nothing)

Type Parameters

T

The type of value to test. Must be a reference type.

Parameters

value
T

The reference to test for null.

paramName
String

The name of the parameter being validated. This is passed to the ArgumentNullException constructor.

message
String

An optional error message to include in the ArgumentNullException.

Applies to