0

I am writing a plugin in C#, and one method does the same thing in two different ways. What I have currently is just the same (fairly complex) method written twice, with a slight difference in the output. But I'm wondering if there is a way to determine the origin of the call, within the called method?

I.e.:

Method A()
{
    Method C();
}

Method B()
{
    Method C();
}

Method C()
{
    if (called from Method B)
    { foo; }
    else if (called from Method A)
    { bar; }
}

Because it's a plugin, I can't alter Method A or B to add in a variable to identify which is which.

Ben
  • 2,433
  • 5
  • 39
  • 69

0 Answers0