Figuring out the Call chain

Posted by BDotA on Programmers See other posts from Programmers or by BDotA
Published on 2012-09-27T15:18:27Z Indexed on 2012/09/27 15:50 UTC
Read the original article Hit count: 231

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?

© Programmers or respective owner

Related posts about c#

Related posts about design-patterns