Answers for "two question marks together mean in C#"

C#
0

two question marks together mean in C#

var x = foo ?? bar;

// expands to:
var x = foo != null ? foo : bar;

// which further expands to:
if(foo != null)
    var x = foo;
else
    var x = bar;
Posted by: Guest on July-01-2021

C# Answers by Framework

Browse Popular Code Answers by Language