Mono Class Library: System.Type Overview | Members

System.Type.BaseType Property

Gets the base Type of the current Type .

public abstract Type BaseType { get; }

Value

A Type object representing the type from which the current Type directly inherits, or null 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 null 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 .

If the current instance represents a constructed generic type, the base type reflects the generic arguments.

If the current instance represents an unassigned type parameter, System.Type.BaseType returns the base class type constraint declared for that parameter, or object if no base class type constraint was declared.

Operation
This property is read-only.

Example

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

Requirements

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