MemberInfo.ReflectedType MemberInfo.ReflectedType MemberInfo.ReflectedType MemberInfo.ReflectedType Property

정의

MemberInfo의 이 인스턴스를 가져오는 데 사용된 클래스 개체를 가져옵니다.Gets the class object that was used to obtain this instance of MemberInfo.

public:
 abstract property Type ^ ReflectedType { Type ^ get(); };
public abstract Type ReflectedType { get; }
member this.ReflectedType : Type
Public MustOverride ReadOnly Property ReflectedType As Type

속성 값

Type 개체를 얻는 데 사용된 MemberInfo 개체입니다.The Type object through which this MemberInfo object was obtained.

구현

예제

다음 코드 예제에서는 하는 방법을 ReflectedType 때 변경 멤버 Object.ToString 에서 표시 되는 MemberInfo 형식에서 가져온 Object 들어오고를 MemberInfo 에서 가져온는 MemberInfo 상속하는자체클래스Object 를 재정의 하지 않습니다 하지만 Object.ToString합니다.The following code example shows how the ReflectedType changes when the member Object.ToString is viewed from a MemberInfo obtained from type Object and from a MemberInfo obtained from the MemberInfo class itself, which inherits Object but does not override Object.ToString.

using namespace System;
using namespace System::Reflection;

int main()
{
    MemberInfo^ m1 = Object::typeid->GetMethod("ToString");
    MemberInfo^ m2 = MemberInfo::typeid->GetMethod("ToString");

    Console::WriteLine("m1.DeclaringType: {0}", m1->DeclaringType);
    Console::WriteLine("m1.ReflectedType: {0}", m1->ReflectedType);
    Console::WriteLine();
    Console::WriteLine("m2.DeclaringType: {0}", m2->DeclaringType);
    Console::WriteLine("m2.ReflectedType: {0}", m2->ReflectedType);

    //Console::ReadLine();
}

/* This code example produces the following output:

m1.DeclaringType: System.Object
m1.ReflectedType: System.Object

m2.DeclaringType: System.Object
m2.ReflectedType: System.Reflection.MemberInfo
 */
using System;
using System.Reflection;

public class Example
{
    static void Main()
    {
        MemberInfo m1 = typeof(Object).GetMethod("ToString");
        MemberInfo m2 = typeof(MemberInfo).GetMethod("ToString");

        Console.WriteLine("m1.DeclaringType: {0}", m1.DeclaringType);
        Console.WriteLine("m1.ReflectedType: {0}", m1.ReflectedType);
        Console.WriteLine();
        Console.WriteLine("m2.DeclaringType: {0}", m2.DeclaringType);
        Console.WriteLine("m2.ReflectedType: {0}", m2.ReflectedType);

        //Console.ReadLine();
    }
}

/* This code example produces the following output:

m1.DeclaringType: System.Object
m1.ReflectedType: System.Object

m2.DeclaringType: System.Object
m2.ReflectedType: System.Reflection.MemberInfo
 */
Imports System
Imports System.Reflection

Module Example

    Sub Main()

        Dim m1 As MemberInfo = GetType(Object).GetMethod("ToString")
        Dim m2 As MemberInfo = GetType(MemberInfo).GetMethod("ToString")

        Console.WriteLine("m1.DeclaringType: {0}", m1.DeclaringType)
        Console.WriteLine("m1.ReflectedType: {0}", m1.ReflectedType)
        Console.WriteLine()
        Console.WriteLine("m2.DeclaringType: {0}", m2.DeclaringType)
        Console.WriteLine("m2.ReflectedType: {0}", m2.ReflectedType)

        'Console.ReadLine()
    End Sub
End Module

' This code example produces the following output:
'
' m1.DeclaringType: System.Object
' m1.ReflectedType: System.Object
'
' m2.DeclaringType: System.Object
' m2.ReflectedType: System.Reflection.MemberInfo
'

설명

합니다 ReflectedType 속성 검색을 Type 개체의이 인스턴스를 사용한 MemberInfo합니다.The ReflectedType property retrieves the Type object that was used to obtain this instance of MemberInfo. 값에서 다를 수 있습니다이 DeclaringType 속성이 MemberInfo 개체 기본 클래스에서 상속 된 멤버를 나타냅니다.This may differ from the value of the DeclaringType property if this MemberInfo object represents a member that is inherited from a base class.

경우는 MemberInfo 개체가 멤버인 전역 (에서 가져온 경우에, 합니다 Module.GetMethods 모듈에서 전역 메서드를 반환 하는 메서드), 반환 된 DeclaringType 됩니다 null합니다.If the MemberInfo object is a global member (that is, if it was obtained from the Module.GetMethods method, which returns global methods on a module), the returned DeclaringType will be null.

적용 대상