Mega Code Archive
Categories
/
C# Book
/
01 Language Basics
0217 doubleQuestionMark operator
?? returns the default value of its type if the value is null. using System; using System.IO; class Test { static void Main() { int? i = null; int j = i ?? 0; Console.WriteLine(j); } } The output: 0