I am not sure why you have a second class inside
ClassA
. But you need to instantiate the
var
variable before you can reference it. So add a constructor to
ClassA
as follows:
public class ClassA
{
public MyClass var { get; set; }
public class MyClass
{
public string user { get; set; }
public string pass { get; set; }
}
public ClassA()
{
var = new MyClass();
}
}
[edit]
Well it all depends on exactly what you are trying to do. But as far as I can see you only need one class and that is
MyClass
, so you can get rid of
ClassA
.
public class MyClass
{
public string user { get; set; }
public string pass { get; set; }
}
Then all you need in your main method is:
MyClass var = new MyClass();
var.user = "TestUser";
var.pass = "testpass";
[/edit]