Nullable<T>(T) 构造函数

定义

Nullable<T> 结构的新实例初始化为指定值。Initializes a new instance of the Nullable<T> structure to the specified value.

public:
 Nullable(T value);
public Nullable (T value);
new Nullable<'T (requires 'T : struct)> : 'T -> Nullable<'T (requires 'T : struct)>
Public Sub New (value As T)

参数

value
T

一个值类型。A value type.

注解

Nullable<T>构造函数将 HasValue 新对象的属性初始化 Nullable<T>true ,并将属性初始化 Value 为参数的值 valueThe Nullable<T> constructor initializes the HasValue property of the new Nullable<T> object to true, and the Value property to the value of the value parameter.

适用于