Delen via


Requires.NotNullAllowStructs<T>(T, String) Method

Definition

Throws an exception if the specified parameter's value is null.

public:
generic <typename T>
 static T NotNullAllowStructs(T value, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static T NotNullAllowStructs<T> (T value, string? parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static T NotNullAllowStructs<T> (T value, string? parameterName = default);
[<System.Diagnostics.DebuggerStepThrough>]
static member NotNullAllowStructs : 'T * string -> 'T
Public Shared Function NotNullAllowStructs(Of T) (value As T, parameterName As String) As T
Public Shared Function NotNullAllowStructs(Of T) (value As T, Optional parameterName As String = Nothing) As T

Type Parameters

T

The type of the parameter.

Parameters

value
T

The value of the argument.

parameterName
String

The name of the parameter to include in any thrown exception. If this argument is omitted (explicitly writing null does not qualify), the expression used in the first argument will be used as the parameter name.

Returns

T

The value of the parameter.

Attributes

Exceptions

Thrown if value is null.

Remarks

This method exists for callers who themselves only know the type as a generic parameter which may or may not be a class, but certainly cannot be null.

Applies to