I've noticed that .NET 4.5 has a new attribute called [CallerMemberNameAttribute] which, when attached to a parameter of a method, will supply the string name of the method that called that method (if that makes sense).
However, unfortunately (because I want to make something with XNA) I'm only targeting .NET 4.0.
I want to be able to do something like:
void MethodA() {
MethodB();
}
void MethodB() {
string callingMethodName = (...?);
Console.WriteLine(callingMethodName);
}
Where my output would be MethodA.
I know I could do this via stack trace, but that's a) Unreliable and b) Sloooow... So I'm wondering if there's any other way to glean that information, however that may be...
I was hoping for any ideas or knowledge that anyone might have on the issue. Thanks in advance :)