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.

Type.BaseType Property

Gets the type from which the current Type directly inherits.

[Visual Basic]
Public MustOverride ReadOnly Property BaseType As Type
[C#]
public abstract Type BaseType {get;}
[C++]
public: __property virtual Type* get_BaseType() = 0;
[JScript]
public abstract function get BaseType() : Type;

Property Value

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.

Remarks

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 Object and from zero or more base interfaces; therefore, the base type of an interface is considered to be Object. The base interfaces can be determined with GetInterfaces or FindInterfaces.

This property is read-only.

Example

[Visual Basic, C#, C++] The following example demonstrates using the BaseType property.

[Visual Basic] 
Imports System

Class TestType
   
    Public Shared Sub Main()
        Dim t As Type = GetType(Integer)
        Console.WriteLine("{0} inherits from {1}.", t, t.BaseType)
    End Sub 'Main
End Class 'TestType

[C#] 
using System;
class TestType 
{
    public static void Main() 
    {
        Type t = typeof(int);
        Console.WriteLine("{0} inherits from {1}.", t,t.BaseType);
    }
}

[C++] 
#using <mscorlib.dll>

using namespace System;

void main() {
   Type*  t = __typeof(int);
   Console::WriteLine(S"{0} inherits from {1}.", t, t->BaseType);
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Type Class | Type Members | System Namespace | Object | GetInterfaces | FindInterfaces | UnderlyingSystemType | IsSubclassOf

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft