Declare a nullable type by adding the ? type modifier in a value type declaration.
using System; public class MainClass { double? variable1 = null; static void Main() { int? variablea = null; Console.WriteLine(variablea.HasValue); // false int variableb = variablea ?? 5; Console.WriteLine(variableb); // 5 } }