Is it possible to get a reference to the object that is calling a function inside that function? (Without passing it has a parameter)
Example:
Or is there other ways of doing this?Code:Interface I { void CallerMethod(); void CalledBackMethod(); } public class A : I { public void CallerMethod() { B b = new B(); b.CalledMethod(); } public void CalledBackMethod() { //Do something } } public class B { public void CalledMethod() { I i = GetCallingObject(); //This is what I want!! i.CalledBackMethod() } }
Thanks!




Reply With Quote