Guard.IsNotNull Method

Definition

Overloads

IsNotNull<T>(Nullable<T>, String)

Asserts that the input value is not null.

IsNotNull<T>(T, String)

Asserts that the input value is not null.

IsNotNull<T>(Nullable<T>, String)

Asserts that the input value is not null.

public static void IsNotNull<T> (T? value, string name) where T : struct;
static member IsNotNull : Nullable<'T (requires 'T : struct)> * string -> unit (requires 'T : struct)
Public Shared Sub IsNotNull(Of T As Structure) (value As Nullable(Of T), name As String)

Type Parameters

T

The type of nullable value type being tested.

Parameters

value
Nullable<T>

The input value to test.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is null.

Remarks

The method is generic to avoid boxing the parameters, if they are value types.

Applies to

IsNotNull<T>(T, String)

Asserts that the input value is not null.

public static void IsNotNull<T> (T? value, string name) where T : class;
static member IsNotNull : 'T * string -> unit (requires 'T : null)
Public Shared Sub IsNotNull(Of T As Class) (value As T, name As String)

Type Parameters

T

The type of reference value type being tested.

Parameters

value
T

The input value to test.

name
String

The name of the input parameter being tested.

Exceptions

Thrown if value is null.

Applies to