分类目录

链接

2024 年 5 月
 12345
6789101112
13141516171819
20212223242526
2728293031  

近期文章

热门标签

新人福利,免费薅羊毛

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,945)