I'm trying to understand usage of collection in C# and also doing practice on how to define classes base on a statement given in msdn example since its class is not posted and left to reader. I came up with following classes but need to know if it this is right or wrong:
Statement says:
// ListLeagueList is a list of League objects.
// Each League object has a Name and a collection of Division objects.
// Each Division has a Name and a collection of Team objects,
// and each Team object has a Name.
public class Team
{
private string teamName;
public string TeamName
{
get { return teamName; }
set { teamName = value; }
}
}
public class Division
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
public List<Team> DivisionList;
}
public class League
{
private string Name;
public string name
{
get { return name; }
set { name = value; }
}
List<Division> DivisionList;
}
Thanks.