Export (0) Print
Expand All

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 abstract Type ReflectedType { get; }
/** @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 System;
using System.IO;
using 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 ", Mymemberinfoarray.Length); 
        Console.Write("{0}.", MyType.FullName); 
 
        foreach (MemberInfo Mymemberinfo in Mymemberinfoarray) 
        { 
            Console.Write("\n" + Mymemberinfo.Name + " reflected type - " +
                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

Community Additions

ADD
Show:
© 2014 Microsoft