title: Returning Most Frequent Character(s) in a String
body: <p>Trying to achieve this using a Dictionary. Currently, I have this method:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Returns the character(s) with the highest occurence in this string.  
  /// &lt;/summary&gt;
  /// &lt;param name="str"&gt;the tring containing the characters&lt;/param&gt;
  /// &lt;returns&gt;the character or characters with the highest occurence&lt;/returns&gt;
  static char[] GetMostFrequentChar(string str)
  {
      var chars = new Dictionary&lt;char, int&gt;();
      List&lt;char&gt; mostCommon = new List&lt;char&gt;();  
      for (int i = 0; i &lt; str.Length; i++)
      {
          if (chars.ContainsKey(str[i]))
          {
              int curr = chars[str[i]];
              chars[str[i]] = curr + 1; 
          } else // character not in dictionary 
          {
              chars.Add(str[i], 1); // initial count for an added character is 1
          }
      }
      foreach (KeyValuePair&lt;char, int&gt; entry in chars)
      {
          if (entry.Value == chars.Keys.Max())
          {
              mostCommon.Add(entry.Key); 
          }
      }
      char[] result = mostCommon.ToArray();
      return result; 
  }
  </code></pre>
  
  <p>It's supposed to return an array containing the most frequent character(s), but I seem to get an empty array whenever I run this method on an input string. Where did I go wrong? </p>
  
  <p>I know there are ways to do it without a Dictionary, but I'm curious how it works with a Dictionary. </p>