title: Decrypting text using frequency analysis in c#.
body: <p>I've been tasked with decrypting a text file using frequency analysis. This isn't a do it for me question but i have absolutley no idea what to do next. What i have so far reads in the text from file and counts the frequency of each letter. If someone could point me in the right direction as to swapping letters depending on their frequency it would be much appreciated.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.IO;
  
  namespace freqanaly
  {
      class Program
      {
          static void Main()
          {
              string text = File.ReadAllText("c:\\task_2.txt");
              char[,] message = new char[2,26];
              Console.Write(text); int count = 0;
              for (int x = 'A'; x &lt;= 'Z'; x++)
              {
                  message[0, count] = (char)x;
                  Console.WriteLine(message[0, count]);
                  count++;
              }
  
              foreach (char c in text)
              {  count = 0;
                  for (int x = 'A'; x &lt;= 'Z'; x++)
                  {
                      if (c == x)
                      {
                          message[1, count]++;
                      }
                      count++;
                  }
              }
  
              Console.ReadKey();
              for (int x = 0; x &lt;= 25; x++)
              {
                  Console.Write(message[0, x]); Console.Write(" = "); Console.WriteLine((int)message[1, x]);
              }
              Console.ReadKey();
          }
      }
  }
  </code></pre>