using Microsoft.Win32; RegistryKey myKey = Registry.CurrentUser.OpenSubKey("Software\\MyApp", true); if (myKey != null) { myKey.DeleteSubKeyTree("Settings"); Console.WriteLine("Subkey deleted successfully."); }In this example, the code checks if the subkey named "Settings" exists under the "Software\\MyApp" key within the Current User registry hive. If it does exist, the DeleteSubKeyTree method is called to delete the entire subkey and its subkeys and values. If the deletion is successful, a message is displayed in the console. The package library for this functionality is the Microsoft.Win32.Registry class which is part of the .NET Framework.