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.

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

public abstract Type BaseType { get; }
/** @property */
public abstract Type get_BaseType ()

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 or an interface.

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:

class B<U> { }
class C<T> : B<T> { }

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.

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

import System.*;

class TestType
{
    public static void main(String[] args)
    {
        Type t = int.class.ToType();
        Console.WriteLine("{0} inherits from {1}.", t, t.get_BaseType());
    } //main
} //TestType

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

Show:
© 2014 Microsoft