public static void Delete(this RegistryKey key) { using (var parentKey = key.GetParent(true)) { var keyName = key.Name.Split('\\').Last(); parentKey.DeleteSubKeyTree(keyName); } }
public static RegistryKey GetParent(this RegistryKey key) { return(key.GetParent(false)); }