Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public static string FormatAsXML(Person p)
 {
     return new XElement("Person",
         new XElement("FirstName", p.FirstName),
         new XElement("LastName", p.LastName)).ToString();
 }
Esempio n. 3
0
 public static string FormatAsConsole(Person p)
 {
     return string.Format("{0}\t{1}", p.FirstName, p.LastName);
 }