Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Nullable::GetUnderlyingType Method (Type^)

 

Returns the underlying type argument of the specified nullable type.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public:
static Type^ GetUnderlyingType(
	Type^ nullableType
)

Parameters

nullableType
Type: System::Type^

A Type object that describes a closed generic nullable type.

Return Value

Type: System::Type^

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

Exception Condition
ArgumentNullException

nullableType is null.

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.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft