Gets the class object that was used to obtain this instance of MemberInfo.
using System;
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);
}
}
Related examples in the same category