Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MemberInfo.ReflectedType Property

Gets the class object that was used to obtain this instance of MemberInfo.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public:
virtual property Type^ ReflectedType {
	Type^ get () abstract;
}
/** @property */
public abstract Type get_ReflectedType ()

public abstract function get ReflectedType () : Type

Property Value

The Type object through which this MemberInfo object was obtained.

The ReflectedType property retrieves the Type object that was used to obtain this instance of MemberInfo. A MemberInfo object represents a member of a particular class or interface.

In order to obtain a MethodInfo object:

  • The Type object that represents the class or interface that supports the method is queried. This property holds a reference to that Type object.

  • If the reflected type is the same class as the declaring class, the member is defined on the declaring class, not on a base class.

  • If the MemberInfo object is a global member, (that is, it was obtained from Module.GetMethods, which returns global methods on a module), then the returned DeclaringType will be a null reference (Nothing in Visual Basic).

The following example gets ReflectedType property for the specified type.

using namespace System;
using namespace System::IO;
using namespace System::Reflection;
int main()
{
   Console::WriteLine( "\nReflection.MemberInfo" );
   
   // Get the Type and MemberInfo.
   Type^ MyType = Type::GetType( "System.IO.BufferedStream" );
   array<MemberInfo^>^Mymemberinfoarray = MyType->GetMembers();
   
   // Get and display the DeclaringType method.
   Console::Write( "\nThere are {0} members in ", Mymemberinfoarray->Length );
   Console::Write( "{0}.", MyType->FullName );
   System::Collections::IEnumerator^ enum0 = Mymemberinfoarray->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      MemberInfo^ Mymemberinfo = safe_cast<MemberInfo^>(enum0->Current);
      Console::Write( "\n{0} reflected type - {1}", Mymemberinfo->Name, Mymemberinfo->ReflectedType );
   }
}


import System.*;
import System.IO.*;
import System.Reflection.*;

class MyMemberInfo
{
    public static void main(String[] args)
    {
        Console.WriteLine("\nReflection.MemberInfo");

        // Get the Type and MemberInfo.
        Type myType = Type.GetType("System.IO.BufferedStream");
        MemberInfo myMemberInfoArray[] = myType.GetMembers();

        // Get and display the DeclaringType method.
        Console.Write("\nThere are {0} members in ",
            String.valueOf(myMemberInfoArray.length));
        Console.Write("{0}.", myType.get_FullName());
        for (int iCtr = 0; iCtr < myMemberInfoArray.length ; iCtr++ ) {
            MemberInfo myMemberInfo = myMemberInfoArray[iCtr];
            Console.Write(("\n" + myMemberInfo.get_Name() 
                + " reflected type - " + myMemberInfo.get_ReflectedType()));
        }
    } //main
} //MyMemberInfo

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft