Eric Brough

Eric Brough

  • NA
  • 3
  • 1.3k

How do I implement a method like myCountry.Towns.Add();

Feb 12 2014 1:48 PM


I have a class called Country.  I can instantiate it by Country myCountry = new County();


It has method, AddTown(string townName) { ... }  which can be called like myCountry.AddTown("London");


How can I add an alternative method with identical functionality but which is called like myCountry.Towns.Add("London");


I cant figure out how to implement the '.Towns.' part of the naming structure.





Answers (4)