Methods A and B call method C. Now how to find out inside C who called it?

Posted by Aseem Gautam on Stack Overflow See other posts from Stack Overflow or by Aseem Gautam
Published on 2010-04-14T06:26:53Z Indexed on 2010/04/14 6:33 UTC
Read the original article Hit count: 255

Filed under:

I have some code in method C that will get executed based upon the who called it.

public void C()
{
    if(A called me) { .... }
    if(B called me) { .... }
}

One way is to use a flag variable. Set the variable before calling C and then inside C process the flag.

Any other ideas?

© Stack Overflow or respective owner

Related posts about c#