private static void PrintAsNumber(object number, Formatting format) { switch (format) { case Formatting.Round: Console.WriteLine("{0:f2}", number); break; case Formatting.Percent: Console.WriteLine("{0:p0}", number); break; case Formatting.AlignRight: Console.WriteLine("{0,8}", number); break; default: throw new ArgumentException("Invalid formatting parameter!"); } }