{ // main chunk public static void Main() { Contact c1 = new Contact("Marie Ortiz", "773-508-7890", "*****@*****.**"); Contact c2 = new Contact("Otto Heinz", "773-508-9999", "*****@*****.**"); Console.WriteLine("Marie's full name: " + c1.GetName()); Console.WriteLine("Her phone number: " + c1.GetPhone()); Console.WriteLine("Her email: " + c1.GetEmail()); Console.WriteLine("All together:\n{0}", c1); Console.WriteLine("Full contact info for Otto:"); c2.Print(); c1.SetEmail("*****@*****.**"); c2.SetPhone("123-456-7890"); Contact c3 = new Contact("Amy Li", "847-111-2222", "*****@*****.**"); Console.WriteLine("With changes and added contact:"); var allc = new List <Contact>(new Contact[] { c1, c2, c3 }); foreach (Contact c in allc) { Console.WriteLine("\n" + c); } }
public static void Main() { Contact c1 = new Contact("Marie Ortiz", "773-508-7890", "*****@*****.**"); Contact c2 = new Contact("Otto Heinz", "773-508-9999", "*****@*****.**"); Console.WriteLine("Marie's full name: " + c1.GetName()); Console.WriteLine("Her phone number: " + c1.GetPhone()); Console.WriteLine("Her email: " + c1.GetEmail()); Console.WriteLine("\nFull contact info for Otto:"); c2.Print(); }
// main chunk public static void Main() { Contact c1 = new Contact("Marie Ortiz", "773-508-7890", "*****@*****.**"); Contact c2 = new Contact("Otto Heinz", "773-508-9999", "*****@*****.**"); Console.WriteLine("Marie's full name: " + c1.GetName()); Console.WriteLine("Her phone number: " + c1.GetPhone()); Console.WriteLine("Her email: " + c1.GetEmail()); Console.WriteLine("All together:\n{0}", c1); Console.WriteLine("Full contact info for Otto:"); c2.Print(); c1.SetEmail("*****@*****.**"); c2.SetPhone("123-456-7890"); Contact c3 = new Contact("Amy Li", "847-111-2222", "*****@*****.**"); Console.WriteLine("With changes and added contact:"); var allc = new List<Contact>(new Contact[] {c1, c2, c3}); foreach(Contact c in allc) { Console.WriteLine("\n"+c); } }