Im new to C# programming. Can someone please explain the following code:
Console.WriteLine( \"{0}{1,10}\", \"Face\", \"Frequency\" ); //Headings
Console.Writ
It adds padding to the left. Very useful for remembering the various string formatting patterns is the following cheat sheet:
.NET String.Format Cheat Sheet
Positive values add padding to the left, negative add padding to the right
Sample Generates
String.Format("[{0, 10}]", "Foo"); [∙∙∙∙∙∙∙Foo]
String.Format("[{0, 5}]", "Foo"); [∙∙Foo]
String.Format("[{0, -5}]", "Foo"); [Foo∙∙]
String.Format("[{0, -10}]", "Foo"); [Foo∙∙∙∙∙∙∙]