Created
September 19, 2019 16:26
Revisions
-
mpetrinidev created this gist
Sep 19, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ class Program { static void Main(string[] args) { static int? GetNullAge() => null; static int? GetAge() => 27; int? age = GetNullAge(); //Old Way //if (age == null) //{ // age = GetAge(); //} //C# 7 //age = age ?? GetAge(); //C# 8.0 age ??= GetAge(); Console.WriteLine(age); Console.ReadLine(); } }