Type.DeclaringType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


このプロパティは、MemberInfo から継承した抽象プロパティを実装します。
現在の Type がジェネリック型またはジェネリック メソッドの定義の型パラメータを表している場合、DeclaringType プロパティおよび DeclaringMethod プロパティは、ジェネリック型定義が最初に定義されたジェネリック型定義またはジェネリック メソッド定義を識別します。
-
DeclaringMethod プロパティが MethodInfo を返す場合、その MethodInfo はジェネリック メソッド定義を表し、現在の Type オブジェクトはそのジェネリック メソッド定義の型パラメータを表します。
-
DeclaringMethod プロパティが null 参照 (Visual Basic では Nothing) を返す場合、DeclaringType プロパティは常にジェネリック型定義を表す Type オブジェクトを返します。Type オブジェクトは、そのジェネリック型定義の型パラメータを表します。
ジェネリック メソッドの型パラメータの場合、このプロパティはジェネリック メソッド定義を含む型を返します。

派生クラスでメソッドの型宣言を表示するコード例を次に示します。
Imports System Imports System.Reflection Imports Microsoft.VisualBasic Public MustInherit Class dtype Public MustInherit Class MyClassA Public MustOverride Function m() As Integer End Class Public MustInherit Class MyClassB Inherits MyClassA End Class Public Shared Sub Main() Console.WriteLine("The declaring type of m is {0}.", _ GetType(MyClassB).GetMethod("m").DeclaringType) End Sub End Class
using System; using System.Reflection; public abstract class dtype { public abstract class MyClassA { public abstract int m(); } public abstract class MyClassB : MyClassA { } public static void Main(string[] args) { Console.WriteLine("The declaring type of m is {0}.", typeof(MyClassB).GetMethod("m").DeclaringType); } }
using namespace System; using namespace System::Reflection; public ref class dtype abstract { public: ref class MyClassA abstract { public: virtual int m() = 0; }; ref class MyClassB abstract: public MyClassA{}; }; int main() { Console::WriteLine( "The declaring type of m is {0}.", dtype::MyClassB::typeid->GetMethod( "m" )->DeclaringType ); }
import System.*; import System.Reflection.*; abstract public class Dtype { abstract public class MyClassA { public abstract int M(); } //MyClassA abstract public class MyClassB extends MyClassA { } //MyClassB public static void main(String[] args) { Console.WriteLine("The declaring type of M is {0}.", MyClassB.class.ToType().GetMethod("M").get_DeclaringType()); } //main } //Dtype

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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


_Type.DeclaringType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)

このメンバを宣言するクラスの Type オブジェクト。型が入れ子にされている場合、このプロパティは外側の型を返します。


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からType.DeclaringTypeを検索する場合は、下記のリンクをクリックしてください。

- Type.DeclaringTypeのページへのリンク