Answers for "null check syntax c#"

C#
0

null check syntax c#

//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();
}
Posted by: Guest on November-16-2021

C# Answers by Framework

Browse Popular Code Answers by Language