C# Nullable Types

int? x = null;

int j = x.GetValueOrDefault();
#  x  null,则返回 int default value

int k;
if (x.HasValue) k = x.Value;
#  x  null,访问 Value 将抛出 InvalidOperationException

int y = x ?? -1;
#  x  null,则将 -1 赋值给 y

x + y
#  x  null,结果是 null