Requires.NotDefault<T>(T, String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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
引发。