C# MethodInfo ReflectedType

Description

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

Syntax

MethodInfo.ReflectedType has the following syntax.


public abstract Type ReflectedType { get; }

Example


using System;/*w  ww. j  a  v a  2s .  co 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