<p><strong>Closed as exact duplicate of <a href="https://stackoverflow.com/questions/171970/how-can-i-find-the-method-that-called-the-current-method">"How can I find the method that called the current method?"</a></strong></p>

<p>Is <a href="https://stackoverflow.com/questions/280389/javascript-how-do-you-find-the-caller-function">this</a> possible with c#?</p>

<pre><code>void main()
{
   Hello();
}

void Hello()
{
  // how do you find out the caller is function 'main'?
}
</code></pre>

```
```
Console.WriteLine(new StackFrame(1).GetMethod().Name);
```
```
However, this is not robust, especially as optimisations (such as JIT inlining) can monkey with the perceived stack frames.