I was wondering if there is any (preferably relatively straighforward) way for a method in C# to obtain the object which made the call. For example...
namespace Example
{
public class A
{
private B b;
public A()
{
b = new B();
b.Call();
}
}
public class B
{
public B()
{
}
public void Call()
{
//So, who called this function?
object caller = null; // Replace null with what so that
// we get the instance of A making
// the call.
}
}
}
I hope this makes some sense. Any hints / tips are much appreciated. -- The Last Bastion