System.Type.BaseType Property

Gets the type from which the current Type directly inherits.


public abstract Type BaseType { get; }


A Type object representing the type from which the current Type directly inherits, or null if the current Type represents the object class.


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 null is returned as the base type of object.

Interfaces inherit from zero or more base interfaces; therefore, this property returns null if the Type object represents an interface. The base interfaces can be determined with Type.GetInterfaces or Type.FindInterfaces(System.Reflection.TypeFilter, object).

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

code reference: System.Type.BaseType#1

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

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

This property is read-only.


The following example demonstrates using the Type.BaseType property.

C# Example

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

The output is

System.Int32 inherits from System.ValueType


Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,