Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
BaseType Property

Type.BaseType Property

Gets the type from which the current Type directly inherits.

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

abstract BaseType : Type with get

Property Value

Type: System.Type
The Type from which the current Type directly inherits, or a null reference (Nothing in Visual Basic) if the current Type represents the Object class or an interface.

Implements

_Type.BaseType

The base type is the type from which the current type directly inherits. Object is the only type that does not have a base type, therefore a null reference (Nothing in Visual Basic) is returned as the base type of Object.

Interfaces inherit from zero or more base interfaces; therefore, this property returns a null reference (Nothing in Visual Basic) if the Type object represents an interface. The base interfaces can be determined with GetInterfaces or FindInterfaces.

If the current Type represents a constructed generic type, the base type reflects the generic arguments. For example, consider the following declarations:

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

For the constructed type C<int> (C(Of Integer) in Visual Basic), the BaseType property returns B<int>.

If the current Type represents a type parameter of a generic type definition, BaseType returns the class constraint, that is, the class the type parameter must inherit. If there is no class constraint, BaseType returns System.Object.

This property is read-only.

The following example demonstrates using the BaseType property.

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

The following example uses recursion to list the complete inheritance hierarchy of each class found in an assembly. The example defines a class named C that derives from a class named B, which, in turn, derives from a class named A.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft