using System; public class Test { public static void Main() { int? nullableInt = null; int nowInt = (int)nullableInt; } }
Standard input is empty
Standard output is empty
Unhandled Exception: System.InvalidOperationException: Nullable object must have a value. at System.Nullable`1[System.Int32].get_Value () [0x00000] in <filename unknown>:0 at Test.Main () [0x00000] in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Nullable object must have a value. at System.Nullable`1[System.Int32].get_Value () [0x00000] in <filename unknown>:0 at Test.Main () [0x00000] in <filename unknown>:0