access property value of one class from another internal class in C#

Posted by starz26 on Stack Overflow See other posts from Stack Overflow or by starz26
Published on 2010-04-14T11:15:24Z Indexed on 2010/04/14 11:23 UTC
Read the original article Hit count: 240

Filed under:
|
|

how do i acces the property value from an internal class , see below?

namespace N1
{
    public class ClassA
    {
       string var1 = null;
       private ClassB  b;
       public ClassA()
       {
          var1 = "one";
          b = new ClassB();
       }
       //property 
       public string Var1
       {
          get{ return var1; }
       }
}

namespace N1
{
   internal class ClassB  
   {
     private void method()
     {
      // I need to access the value of Var1( property) from here, how to do this?
     }
   }
}

© Stack Overflow or respective owner

Related posts about c#2.0

Related posts about .NET