static void Main(string[] args) { Person me = new Person(); me.FirstName = "Alex"; me.LastName = "Kaplunov"; // Console.WriteLine(me.Format()); Oh no I can't do it Console.WriteLine("Console Output:"); Console.WriteLine(PersonReport.FormatAsConsole(me)); Console.WriteLine("\nXML Output:"); Console.WriteLine(PersonReport.FormatAsXML(me)); Console.ReadKey(); }
public static string FormatAsXML(Person p) { return new XElement("Person", new XElement("FirstName", p.FirstName), new XElement("LastName", p.LastName)).ToString(); }
public static string FormatAsConsole(Person p) { return string.Format("{0}\t{1}", p.FirstName, p.LastName); }