title: How can I calculate the sum of the integers in a dictionary? Tried num = num + pair.Value but gives me total + 1 for some reason
body: <p>This is the method I have tried, but it gives me 1 more than it should be because I have the list of hashtags I am counting in notepad, there in one pair line and the last one says line <code>19993</code> but the program outputs <code>19994</code>.</p>
  
  <pre><code>private static void outputNumOfTotalTags(Dictionary&lt;string, int&gt; list, int numOfTags)
  {
      foreach (KeyValuePair&lt;string, int&gt; pair in list)
      {
          numOfTags = numOfTags + pair.Value;
      }
      Console.WriteLine("The total number of hashtags is: {0}\n", numOfTags);
      }
  }
  </code></pre>