Guard.IsNotNull Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
IsNotNull<T>(Nullable<T>, String) |
Asserts that the input value is not |
IsNotNull<T>(T, String) |
Asserts that the input value is not |
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
.