Get run time type of stack frames
问题 I was wondering if it were possible to obtain the run time type of method callers in the stack trace. Consider the following example: class Parent { public void Foo() { var stack = new StackTrace(); foreach (var frame in stack.GetFrames()) { var methodInfo = frame.GetMethod(); Console.WriteLine("{0} (ReflectedType: {1})", methodInfo.ToString(), methodInfo.DeclaringType); } } } class Child : Parent { } If I create an instance of Child and call Foo var child = new Child(); child.Foo(); Foo will