In a dictionary like this:
Dictionary<string, string> openWith = new Dictionary<string, string>();
openWith.Add("txt", "notepad.exe");
openWith.Add("bmp", "paint.exe");
openWith.Add("dib", "paint.exe");
openWith.Add("rtf", "wordpad.exe");
Console.WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]);
The output is:
For Key = "rtf" value = wordpad.exe
What does the {0}
mean?
In addition to the value you wish to print, the
{0} {1}
, etc., you can specify a format. For example,{0,4}
will be a value that is padded to four spaces.There are a number of built-in format specifiers, and in addition, you can make your own. For a decent tutorial/list see String Formatting in C#. Also, there is a FAQ here.