title: Counting letter frequencies
body: <p>I'm reading in a text file using StreamReader to the program. I need to record the frequency of each letter in the string into an array (where index 0 would be A, and so on). What's the simplest approach for this?</p>
  
  <p>Edit:  I had this originally, until I realized it was completely wrong. </p>
  
  <pre><code>int counter = 0;
  int[] freq = new int[26]; // create frequency array
  
  // counts frequency
  while (counter &lt; inValue.Length)
  {
        int A = 65; // ASCII value for "A"
        char x = char.Parse(inValue.Substring(counter, 1)); // get individual characters from string
         int s = (int)x; // cast character to integer value
  
         if (s == A + counter)
               freq[counter]++;
  
               counter++;
   }
  </code></pre>
  
  <p>Where inValue is the text file StreamReader reads into the program.</p>