title: I am trying to decrypt the autokey cipher in C#, but I keep getting an unhandled exception
body: <p>I know how to fix the error, but I don't know where to place the line of code to make it successfully run.  The place that I am having issues with is where I try and create the passletter character.</p>
  
  <pre><code>static string AutokeyDecrypt(string encryptmess, string pass)
      {
          //sets both secret message and password to arrays so they can be shifted
          char[] passkey = pass.ToCharArray();
          char[] decryptmess = encryptmess.ToCharArray();
          char newletter = ' ';
  
          for (int i = 0; i &lt; decryptmess.Length; i++)
          {
              char passletter = (char)(passkey[i] + newletter); //This is the line on which I am having issues. I need to concatenate the key (passletter) with each newletter that I decode.
              char messletter = decryptmess[i];
  
              //shifts the letters in the message back to original using the first letter of the concatenated key
              int shift = passletter - ' '; // passletter - (space character)
              newletter = (char)(messletter - shift); // Add shift to message letter
  
              //loops through the ASCII table
              if (newletter &gt; '~')
              {
                  newletter = (char)(newletter - 94);
              }
              else if (newletter &lt; ' ')
              {
                  newletter = (char)(newletter + 94);
              }
              decryptmess[i] = newletter;
          }
          return new string(decryptmess);
      }
  </code></pre>