The HasValue property returns true if the variable contains a value, or false if it is null. The Value property returns a value if one is assigned. ... The default value for HasValue is false. ... You can also use the == and != operators with a nullable type, as shown in the following example: if (x != null) y = x;