When I try to remove a key from an HKCU that has children, I get an error.
Here is the code I'm using:
using (RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"Software\Policies\", true)) { if (regkey.OpenSubKey("Google") != null) { regkey.DeleteSubKey("Google"); } }
The error I get is:
The registry key has subkeys, and recursive deletes are not supported by this method.
How can I overcome it?
user2061745
source share