// Open the key RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\TestApp", true); // Removes the specified value from the key key.DeleteValue("TestValue");
// Open the key RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\TestApp", true); // Removes the specified value from the key key.DeleteValue("TestValue", true);In this example, the DeleteValue method is used to remove a value named "TestValue" from the "SOFTWARE\TestApp" key in the LocalMachine hive of the Windows Registry. The second parameter "true" indicates that an exception will be thrown if the value does not exist. Overall, the RegistryKey.DeleteValue method is useful for managing values within the Windows Registry Key and is a commonly used feature in C# programming.