title: converting a string to Keys in C#
body: <p>Lets say we store KeyCode value as a string. How do you convert it back to KeyCode?</p>
  
  <p>For example, I've captured a key on keydown event:</p>
  
  <pre><code>string modifier = e.Modifiers.ToString(); // Control
  string key_string = e.KeyCode.ToString(); // D1
  </code></pre>
  
  <p>How to do the following ?</p>
  
  <pre><code>Keys old_key_restored = (Keys)key_string;
  </code></pre>
  
  <p>Code above doesn't work.</p>
  
  <p>EDIT: Daniel is a life savior ;)</p>
  
  <pre><code>Keys key_restored = (Keys) Enum.Parse(typeof(Keys), key_key);
  </code></pre>