Demonstrates some of the formatting flags for writing text to the console
/* C# Programming Tips & Techniques by Charles Wright, Kris Jamsa Publisher: Osborne/McGraw-Hill (December 28, 2001) ISBN: 0072193794 */ /* Format.cs. Demonstrates some of the formatting flags for writing text to the console. Compile this program with the following command line: C:>csc format.cs */ namespace nsFormat { using System; public class Format { static readonly double e = 2.71828; static void Main() { Console.WriteLine ("Integer dollar amount: {0,0:C}", 3); Console.WriteLine ("Floating dollar amount: {0,0:C}", 3.29); Console.WriteLine ("Integer value: {0,0:D5}", 1024); Console.WriteLine ("Integer value: {0,0:N5}", 1024742); Console.WriteLine ("Integer value: {0,0:N}", 1024742); Console.WriteLine ("Integer value: {0,0:N5}", 1024742); Console.WriteLine ("Integer value: {0,0:X}", 1024742); Console.WriteLine ("Floating point e: {0,0:F3}", e); Console.WriteLine ("Floating point e: {0,-8:F5}", e); Console.WriteLine ("Floating point e: {0,-8:E2}", e); Console.WriteLine ("Floating point e: {0,-8:E}", e); } } }