这是我目前所拥有的,但它只是继续使用catch并且密钥永远不会被删除。
private void button7_Click(object sender, EventArgs e)
{
try
{
Microsoft.Win32.Registry.LocalMachine.DeleteSubKey(@"Software/Microsoft/Windows/CurrentVersion/Policies");
}
catch
{
MessageBox.Show("Restrictions already removed. Or there was an error.","Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
我的代码出了什么问题?