mscorlib 2.0.0.0 4.0.0.0 System.Object System.Runtime.InteropServices.ComVisible(true)

A type is said to be nullable if it can be assigned a value or can be assigned null, which means the type has no value whatsoever. By default, all reference types, such as , are nullable, but all value types, such as , are not.

In C# and Visual Basic, you mark a value type as nullable by using the ? notation after the value type. For example, int? in C# or Integer? in Visual Basic declares an integer value type that can be assigned null.

The class provides complementary support for the structure. The class supports obtaining the underlying type of a nullable type, and comparison and equality operations on pairs of nullable types whose underlying value type does not support generic comparison and equality operations.

## Boxing and Unboxing

When a nullable type is boxed, the common language runtime automatically boxes the underlying value of the object, not the object itself. That is, if the property is true, the contents of the property is boxed. If the HasValue property is false, null is boxed. When the underlying value of a nullable type is unboxed, the common language runtime creates a new structure initialized to the underlying value.

Supports a value type that can be assigned null. This class cannot be inherited.

- Method
  2.0.0.0
  4.0.0.0
  System.Int32 DefaultConstructorConstraint NotNullableValueTypeConstraint System.ValueType `` `` To be added.

  Compares the relative values of two objects.

  An integer that indicates the relative values of the and parameters.

  Return Value

  Description

  Less than zero

  The property for is false, and the property for is true.

  -or-

  The properties for and are true, and the value of the property for is less than the value of the property for .

  Zero

  The properties for and are false.

  -or-

  The properties for and are true, and the value of the property for is equal to the value of the property for .

  Greater than zero

  The property for is true, and the property for is false.

  -or-

  The properties for and are true, and the value of the property for is greater than the value of the property for .

  A object. A object. The underlying value type of the and parameters.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean DefaultConstructorConstraint NotNullableValueTypeConstraint System.ValueType `` `` To be added.

  Indicates whether two specified objects are equal.

  true if the parameter is equal to the parameter; otherwise, false.

  The return value depends on the and properties of the two parameters that are compared.

  Return Value

  Description

  true

  The properties for and are false.

  -or-

  The properties for and are true, and the properties of the parameters are equal.

  false

  The property is true for one parameter and false for the other parameter.

  -or-

  The properties for and are true, and the properties of the parameters are unequal.

  A object. A object. The underlying value type of the and parameters.
- Method
  2.0.0.0
  4.0.0.0
  System.Type ``

  A generic type definition is a type declaration, such as , that contains a type parameter list, and the type parameter list declares one or more type parameters. A closed generic type is a type declaration where a particular type is specified for a type parameter.

  For example, if the parameter is the type of Nullable<Int32> in C# (Nullable(Of Int32) in Visual Basic), the return value is the type of (that is, the type argument of the closed generic type).

  Returns the underlying type argument of the specified nullable type.

  The type argument of the parameter, if the parameter is a closed generic nullable type; otherwise, null.

  A object that describes a closed generic nullable type.