[Mono-devel-list] Find Object instance that called a method..

S Umadevi sUmadevi at novell.com
Tue Jun 21 22:41:46 EDT 2005


I guess I phrased my question too simplicitly...:(
Anyway I found my answer with System.Diagonistics.StackFrame.

Thanks
uma


>>> Micha(B³ Ziemski <rook at roo.k.pl> 06/21/05 2:53 PM >>>

>Hi,
> Is there a mechanism to figure out the object instance that called a
>method..
>Ex.
>class A {
>            
>public  void m1()
>{
>  //some code..
>}
>
>}
>
>Class B {
>
>  private m2()
>{
>   A aa = new A();
>    aa.m1();
>
>}
>}
>
>>From method m1 in class A is it possible for me to figure out the
>object instance aa?
>  
>
Use "this" keyword (I hope this is what you are asking for).

public void m1() {
    this.ToString();
}

Regards!
Michal Ziemski
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com 
http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list