using System.Reflection;

namespace DeclaringVsReflected;

class Base
{
    public void Foo()
    {
    }
}

class Derived : Base
{
}

class Program
{
    static void Main()
    {
        MemberInfo bf = typeof(Base).GetMethod("Foo")!;
        MemberInfo df = typeof(Derived).GetMethod("Foo")!;

        Console.WriteLine("Klasa Base    DeclaringType: {0}, ReflectedType: {1}",
                          bf.DeclaringType, bf.ReflectedType);
        Console.WriteLine("Klasa Derived DeclaringType: {0}, ReflectedType: {1}",
                          df.DeclaringType, df.ReflectedType);
    }
}