What is the proper way to check for null values?

前端 未结 10 1978
刺人心
刺人心 2020-12-04 08:05

I love the null-coalescing operator because it makes it easy to assign a default value for nullable types.

 int y = x ?? -1;

That\'s great,

10条回答
提交回复
热议问题