Thursday, August 8, 2013

C# Class Within Another Class

Sometimes you need a parent class in C# to contain another class, the simple method for doing this is as follows:
class ParentClass
{
public string Name { get; set; }
public string Address { get; set; }
public string Email { get; set; }
public ChildClass ChildClass;
}
class ChildClass
{
public string MemberNumber { get; set; }
public string Subscription { get; set; }
}

No comments:

Post a Comment