Nullable::GetUnderlyingType Method
Returns the underlying type argument of the specified nullable type.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- nullableType
- Type: System::Type
A Type object that describes a closed generic nullable type.
Return Value
Type: System::TypeThe type argument of the nullableType parameter, if the nullableType parameter is a closed generic nullable type; otherwise, nullptr.
| Exception | Condition |
|---|---|
| ArgumentNullException | nullableType is nullptr. |
A generic type definition is a type declaration, such as Nullable<T>, 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 nullableType parameter is the type of Nullable<Int32> in C# (Nullable(Of Int32) in Visual Basic), the return value is the type of Int32 (that is, the type argument of the closed generic type).
The following code example defines a method whose return value is of type Nullable<T> of Int32. The code example uses the GetUnderlyingType method to display the type argument of the return value.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.