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

Michał Ziemski rook at roo.k.pl
Tue Jun 21 05:23:15 EDT 2005


>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



More information about the Mono-devel-list mailing list