分类

链接

2025 年 6 月
 1
2345678
9101112131415
16171819202122
23242526272829
30  

近期文章

热门标签

新人福利,免费薅羊毛

C#中值为NULL时计算出错处理方法

 static void Main(string[] args)  {             Nullable<int> x1 = GetNullableType();//可空结构             if (x1.HasValue)//判断是否有值,也就是是否为null             {                 Console.WriteLine("x1有值得{0}", x1.Value); //获取value             }             else             {  Console.WriteLine("x1无值."); }             int? x2 = 0;             int? x3 = x1 + x2;//两个运算数据一个为null则结果为null             int y1 = x3 ?? 1;//结合运算符,如果??前的数据...

.NET 暂无评论 阅读(2,998)