深入理解C#---1.可空类型
https://blog.csdn.net/tianzeyu1992/article/details/52618131
原文:https://blog.csdn.net/qq_35309370/article/details/80096355
除了使用Convert.ToDatetime()外
还可以直接用 DateTime? .Value 获取到的就是一个DateTime类型的值
原文:https://www.cnblogs.com/valu/p/5916095.html
DateTime? dt2 = DateTime.Now;
dt2.GetValueOrDefault().ToString("yyyy-MM-dd");
**************************************************************
int? test = null;//定义一个int?赋值空
int a = test ?? 0;//test??0 当test不为空时,直接返回值,为空时返回??后的值int? n = null;
//int m1 = n; // Will not compile.int m2 = (int)n; // Compiles, but will create an exception if x is null.int m3 = n.Value; // Compiles, but will create an exception if x is null.
int? a;
a.Value不就是int型
a.Value不就是int型