Can i access outer class objects in inner class

Posted by Shantanu Gupta on Stack Overflow See other posts from Stack Overflow or by Shantanu Gupta
Published on 2010-06-02T13:06:48Z Indexed on 2010/06/02 13:13 UTC
Read the original article Hit count: 203

Filed under:
|
|
|
|

I have three classes like this.

class A
{
    public class innerB
       {
       //Do something
       }

    public class innerC
       {
        //trying to access objB here directly or indirectly over here. 
        //I dont have to create an object of innerB, but to access the object created by A
        //i.e.
             innerB objInnerB = objB;
        //not like this
             innerB objInnerB= new innerB();
       }

public innerB objB{get;set;}

}

I want to access the object of class B in Class C that is created by class A. Is it possible somehow to make changes on object of Class A in Class C. Can i get Class A's object by creating event or anyhow.

© Stack Overflow or respective owner

Related posts about c#

Related posts about oop