C# MemberInfo ReflectedType

Description

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

Syntax

MemberInfo.ReflectedType has the following syntax.


public abstract Type ReflectedType { get; }

Example


using System;//  w  ww . ja v a  2 s  .c o  m
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();
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo