Uses the #, 0 and comma characters to format output
/* C# Programming Tips & Techniques by Charles Wright, Kris Jamsa Publisher: Osborne/McGraw-Hill (December 28, 2001) ISBN: 0072193794 */ /* Picture.cs. Uses the #, 0 and comma characters to format output */ using System; public class Picture { static void Main() { Console.WriteLine ("Using the # character"); Console.WriteLine ("\tInteger dollar amount: {0,0:$###.##}", 3); Console.WriteLine ("\tFloating dollar amount: {0,0:$###.##}", 3.29); Console.WriteLine ("\tInteger value: {0,0:###,###}",1428); Console.WriteLine ("\tFloating point value: {0,0:#,###.#####}", 1428.571); Console.WriteLine ("Using the $ character"); Console.WriteLine ("\tInteger dollar amount: {0,0:$000.00}", 3); Console.WriteLine ("\tFloating dollar amount: {0,0:$000.00}", 3.29); Console.WriteLine ("Using the comma alone"); Console.WriteLine ("\tInteger value: {0,0:000,000}", 1428); Console.WriteLine ("\tFloating point value: {0,0:0,000.000}", 1428.571); } }