Figuring out the Call chain
- by BDotA
Let's say I have an assemblyA that has a method which creates an instance of assemblyB and calls its MethodFoo().
Now assemblyB also creates an instance of assemblyC and calls MethodFoo().
So no matter if I start with assemblyB in the code flow or with assemlyA, at the end we are calling that MethodFoo of AssemblyC(). My question is when I am in the MethodFoo() how can I know who has called me? Has it been a call originally from assemblyA or was it from assemlyB?
Is there any design pattern or a good OO way of solving this?