📜  空检查语法 c# 代码示例

📅  最后修改于: 2022-03-11 14:48:48.197000             🧑  作者: Mango

代码示例1
//Check if an object is null before calling a function using the ? operator.
//The ? operator is syntactic suger for the if block below:

//Using the ? operator
myObject?.MyFunc();

//Using an if block.
if (myObject != null)
{
  myObject.MyFunc();
}