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

定义

ArgumentException如果指定的参数的值等于 的默认值,TypeT则引发 。

public:
generic <typename T>
 where T : value class static void NotDefault(T value, System::String ^ parameterName);
[System.Diagnostics.DebuggerStepThrough]
public static void NotDefault<T> (T value, string? parameterName = default) where T : struct;
[<System.Diagnostics.DebuggerStepThrough>]
static member NotDefault : 'T * string -> unit (requires 'T : struct)
Public Shared Sub NotDefault(Of T As Structure) (value As T, Optional parameterName As String = Nothing)

类型参数

T

参数的类型。

参数

value
T

参数的值。

parameterName
String

要包含在任何引发的异常中的参数的名称。 如果省略此参数 (显式写入 null 不符合) ,则第一个参数中使用的表达式将用作参数名称。

属性

例外

如果 为 null 或 为空,则value引发。

适用于