Requires.NotNullAllowStructs<T>(T, String) 方法

定义

如果指定参数的值为 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>]
static member NotNullAllowStructs : 'T * string -> 'T
Public Shared Function NotNullAllowStructs(Of T) (value As T, parameterName As String) As T

类型参数

T

参数的类型。

参数

value
T

参数的值。

parameterName
String

要包含在任何引发的异常中的参数的名称。

返回

T

参数值。

属性

例外

如果 valuenull,则引发。

注解

此方法对于自身仅知道类型为泛型参数的调用方是不是类,但一定不能为 null。

适用于