title: Different ways to add and print keys/values to a dictionary in C#?
body: <p>I couldn't find a relevant thread on this topic, so I decided to ask a new question. I'm at my first steps in the <code>Dictionary</code> class in <strong>C#</strong>, and I have several basic questions. First off, what the difference between this:</p>
  
  <pre><code>Dictionary&lt;int, string&gt; dict = new Dictionary&lt;int, string&gt;();
  
      dict[1] = "hello";
  </code></pre>
  
  <p>and this (if any):</p>
  
  <pre><code>Dictionary&lt;int, string&gt; dict = new Dictionary&lt;int, string&gt;();
  
      dict.Add(1, "hello");
  </code></pre>
  
  <p>My second question is: is there any way to add multiple entries (if I can call a pair of key and value that way) on the same line. Something like <code>int a, b, c;</code>, instead of <code>int a; int b; int c;</code>. Or is it only possible to add them on multiple lines:</p>
  
  <pre><code>dict.Add(1, "hello");
  dict.Add(2, "hey");
  </code></pre>
  
  <p>My last question, concerning the output of a dictionary, is if there is a "better" way to print a dictionary, instead of doing it that way:</p>
  
  <pre><code>foreach (KeyValuePair&lt;int, string&gt; pair in dict)
      {
          Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
      }
  </code></pre>
  
  <p>I mean "better" in terms of faster to type and faster to execute. (I know that it also works with <code>var</code>, instead of <code>KeyValuePair&lt;&gt;</code>.</p>