Share via


Type.BaseType プロパティ

現在の Type の直接の継承元である型を取得します。

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;

プロパティ値

現在の Type の直接の継承元の Type 。現在の Type が Object クラスを表す場合は null 参照 (Visual Basic では Nothing) 。

解説

ベース型は、現在の型の直接の継承元である型です。 Object はベース型を持たない唯一の型であるため、 Object のベース型としては null 参照 (Visual Basic では Nothing) が返されます。

インターフェイスは Object および 0 個以上の基本インターフェイスから継承するため、インターフェイスのベース型は Object と見なされます。基本インターフェイスは、 GetInterfaces または FindInterfaces を使用して判断できます。

このプロパティは読み取り専用です。

使用例

[Visual Basic, C#, C++] BaseType プロパティを使用する例を次に示します。

 
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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

Type クラス | Type メンバ | System 名前空間 | Object | GetInterfaces | FindInterfaces | UnderlyingSystemType | IsSubclassOf