C# 空接合(??)运算符
最近看书看到有C#的空接合运算符
书中示例如下:
int? a= null;
int b;
b= a??10; //b has the value 10
a=3;
b= a??10; //b has the value 3
不怎么理解是什么意思,百度大神搜索后,原来可以这样理解
看代码不废话:
int ?a=null;
if(a==null)
{
b=10;
}
else{
b=a;
}
转载于:https://blog.51cto.com/langyan/420683