本文介绍了什么是" ??"运营商?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道 ??在
迹象code。这是什么呢?我如何使用它? C#
什么 INT?
?它是一个可空INT?
参见:
解决方案
It's called the "null coalescing operator" and works something like this:
Instead of doing:
int? number = null;
int result = number == null ? 0 : number;
You can now just do:
int result = number ?? 0;
这篇关于什么是" ??"运营商?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!