c# nullable type

来源:百度知道 编辑:UC知道 时间:2024/06/16 11:31:04
Nullable types are constructed using the ? type modifier. For example, int? is the nullable form of the predefined type int. A nullable type’s underlying type must be a non-nullable value type.

帮翻译下
underlying type 怎么理解,谢谢!

基类型(基本类型)

Nullable 类型用?构造,如:int?是整型int的Nullable 类型,一个Nullable 类型的基类型必须是值类型,

如int是值类型,它的Nullable 就是int? 如:
int i=0;
int? j=null;
基类型不能是引用类型,如:
string s="abc";
string? s=null;//错误