title: Delete a Registry key using C#
body: <p>I am trying to delete a Registry key like this:</p>
  
  <pre><code>RegistryKey oRegistryKey = Registry.CurrentUser.OpenSubKey(
      "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts", true);
  
  oRegistryKey.DeleteSubKeyTree(".");
  </code></pre>
  
  <p>But that is giving me an exception:</p>
  
  <blockquote>
    <p>Cannot delete a subkey tree because the subkey does not exist</p>
  </blockquote>
  
  <p>If I change <code>DeleteSubKeyTree</code> to <code>DeleteSubKey</code>, I receive a different exception:</p>
  
  <blockquote>
    <p>Registry key has subkeys and recursive removes are not supported by this method</p>
  </blockquote>