c# 运算符 ?、??、?:
用途:简化代码
说明:
- ? 是可空类型和运算符
- int a; //a<>null
- int ?b; //b=null
- int ?c = b+1; //c=null;
- ?? 是空接合运算符
- int?a=null; int b;(声明a和b)
- b=a??2; //b=2;
- a=6;b=a??8;//b=6;
- ?: 是三元运算符(这个大家用的比较多)
原标题:c# 运算符 ?、??、?:
关键词:C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。