Is it possible to access the line of code where a method is called from within that method?
- by Dan Tao
Disclaimers:
I am not interested in doing this in any real production code.
I make no claim that there's a good reason why I'm interested in doing this.
I realize that if this is in any way possible, it must involve doing some highly inadvisable things.
That said... is this possible? I'm really just curious to know.
In other words, if I have something like this:
int i = GetSomeInteger();
Is there any way from within GetSomeInteger that the code could be "aware of" the fact that it's being called in an assignment to the variable i?
Again: no interest in doing this in any sort of real scenario. Just curious!