Type.BaseTypeとは? わかりやすく解説

Type.BaseType プロパティ

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

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説

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

インターフェイスは 0 以上の基本インターフェイスから継承します。したがってType オブジェクトインターフェイスを表す場合、このプロパティnull 参照 (Visual Basic では Nothing) を返します基本インターフェイスは、GetInterfaces または FindInterfaces を使用して判断できます

現在の Type構築ジェネリック型表している場合基本型汎用引数リフレクションます。たとえば、次の宣言について考えてます。

class B<U> { }
class C<T> : B<T> { }
Class B(Of U)
End Class
Class C(Of T)
    Inherits B(Of T)
End Class
generic<typename U> ref class B { };
generic<typename T> class C : B<T> { };

構築C<int> (Visual Basic の場合C(Of Integer)) の場合BaseType プロパティB<int>返します

現在の Typeジェネリック型定義型パラメータ表している場合BaseTypeクラス制約、つまり、型パラメータ継承する必要のあるクラス返しますクラス制約がない場合BaseTypeSystem.Object返します

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

使用例使用例

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
using System;
class TestType 
{
    public static void Main()
 
    {
        Type t = typeof(int);
        Console.WriteLine("{0} inherits from {1}.", t,t.BaseType);
    }
}
using namespace System;
void main()
{
   Type^ t = int::typeid;
   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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

_Type.BaseType プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

COM オブジェクトに、Type.BaseType プロパティへのバージョン依存しないアクセス用意されています。

このプロパティは、CLS準拠していません。  

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As _Type
Dim value As Type

value = instance.BaseType
Type BaseType { get; }
property Type^ BaseType {
    Type^ get ();
}
/** @property */
Type get_BaseType ()

プロパティ
現在の Type直接継承元の Type現在の TypeObject クラスを表す場合null 参照 (Visual Basic では Nothing)。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Type.BaseType」の関連用語

Type.BaseTypeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Type.BaseTypeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS