Template Method Pattern Code Review

Use the Template Method Pattern

Code Review

Code Walkthrough

The Program class creates a list of Person object types and a list of Country object types. The Person and Country data is than sorted.

class Program { static void Main(string[] args) { List<Person> colPerson = new List<Person> { new Person("John", "Doe"), new Person("Jane", "Doe"), new Person("Alan", "Alda"), new Person("Joe", "Bloggs"), new Person("Anon", "Ymous") }; colPerson.Sort();
Console.WriteLine("*** Output of sorting Person objects ****\n"); foreach (Person person in colPerson) { Console.WriteLine(String.Format("{0}, {1}", person.Firstname, person.Lastname)); }
List<Country> colCntry = new List<Country> { new Country("United Kingdom"), new Country("United States"), new Country("Portugal"), new Country("France") }; colCntry.Sort();
Console.WriteLine("\n*** Output of sorting String objects ****\n"); foreach (Country cntry in colCntry) { Console.WriteLine(String.Format("{0}", cntry.CountryName)); }
Console.Read(); } }