public static void PrintNumber(double number, PrintFormatOption format = PrintFormatOption.FloatTwoSymbolsAfterComma) { if (format == PrintFormatOption.FloatTwoSymbolsAfterComma) { Console.WriteLine("{0:f2}", number); } else if (format == PrintFormatOption.Percentage) { Console.WriteLine("{0:p0}", number); } else if (format == PrintFormatOption.PadRightEightSymbols) { Console.WriteLine("{0,8}", number); } else { throw new ArgumentException("Invalid format"); } }
public static void PrintNumber(double number, PrintFormatOption format = PrintFormatOption.FloatTwoSymbolsAfterComma) { if (format == PrintFormatOption.FloatTwoSymbolsAfterComma) { Console.WriteLine("{0:f2}", number); } else if (format == PrintFormatOption.Percentage) { Console.WriteLine("{0:p0}", number); } else if (format == PrintFormatOption.PadRightEightSymbols) { Console.WriteLine("{0,8}", number); } else { throw new ArgumentException("Invalid format"); } }