Registry class. If key exist
问题 Im using the Microsoft.Win32.Registry class. Im trying to make a if RegKey exist statement but don't know how I want something like this: RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\test"); if(key.keyExist("yourKey")) Console.WriteLine("yourKey exist!"); 回答1: As far as I know, the SubKey is stored in a path in the system. So you can do something like this to check out if the SubKey exists: using (RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\test")) { if (key