title: ToString in Dictionary c#
body: <p>I have a <code>Dictionary&lt;int, string&gt;</code> in c# and I need a way to create a string with its content with the format <code>"key1-value1, key2-value2"</code>, etc. </p>
  
  <p>I am new to c#, so I created the following function that achieves this objective:</p>
  
  <pre><code>private string buildString(Dictionary&lt;int, string&gt; info)
  {
      string result = "";
      int i = 1;
      foreach (KeyValuePair&lt;int, string&gt; pair in info)
      {
          if (i &lt; info.Count)
          {
              result += pair.Key + "-" + pair.Value + ",";
          }
          else
          {
              result += pair.Key + "-" + pair.Value;
          }
          i++;
      }
  
      return result;
  }
  </code></pre>
  
  <p>However, this function is inneficient and verbose. I know that C# has <code>String.format</code>, but I am not sure if nor how to use it. </p>
  
  <p>Is there a better way to achieve the same output in a more efficient and less verbose way? If so how?</p>