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?
}
}
}
You need a reference to an instance of Class A.
So either change Class B constructor to accept a reference to class A
or make ClassB’s private method() take in a string?
private void method(string classAVar1)or make ClassA static (haha)