Possible Duplicate:
How can I find the method that called the current method?
I need a way to know the name of calling methods in C#.
For instance:
private void doSomething() { // I need to know who is calling me? (method1 or method2). // do something pursuant to who is calling you? } private void method1() { doSomething(); } private void method2() { doSomething(); }
from http://www.csharp-examples.net/reflection-calling-method-name/