Export (0) Print
Expand All

Type.ReflectedType Property

Gets the class object that was used to obtain this member.

[Visual Basic]
Overrides Public ReadOnly Property ReflectedType As Type
[C#]
public override Type ReflectedType {get;}
[C++]
public: __property Type* get_ReflectedType();
[JScript]
public override function get ReflectedType() : Type;

Property Value

The Type object through which this MemberInfo object was obtained.

Remarks

This property implements the abstract property inherited from MemberInfo.

Example

This example displays the reflected type of a method in a derived class. Although the method m is declared in MyClassA, its reflected type is obtained from MyClassB.

[Visual Basic] 
Imports System
Imports System.Reflection

Public MustInherit Class rtype

    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("Reflected type of m is {0}", _
           GetType(MyClassB).GetMethod("m").ReflectedType)
    End Sub
End Class

[C#] 
using System;
using System.Reflection;
 
public abstract class rtype 
{
    public abstract class MyClassA 
    {
        public abstract int m(); 
    }

    public abstract class MyClassB : MyClassA 
    {
    }

    public static void Main(string[] args) 
    { 
        Console.WriteLine("Reflected type of m is {0}",
            typeof(MyClassB).GetMethod("m").ReflectedType);
    }
}

[C++] 
#using <mscorlib.dll>
using namespace System;
using namespace System::Reflection;

public __abstract __gc class rtype 
{
public:
    __abstract __gc class MyClassA 
    {
    public:
        virtual int m() = 0; 
    };
    __abstract __gc class MyClassB : public MyClassA 
    {
    };
};

int main() 
{ 
    Console::WriteLine(S"Reflected type of m is {0}",
        __typeof(rtype::MyClassB)->GetMethod(S"m")->ReflectedType);
}

[JScript] 
import System;
import System.Reflection;
 
public abstract class rtype {
    public abstract class MyClassA {
        public abstract function m() : int; 
    }

    public abstract class MyClassB extends MyClassA {
    }

    public static function Main() : void  { 
        Console.WriteLine("Reflected type of m is {0}",
            MyClassB.GetMethod("m").ReflectedType);
    }
}
rtype.Main();

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Type Class | Type Members | System Namespace | MemberInfo | DeclaringType

Show:
© 2015 Microsoft