In C#, Register class is defined under Microsoft.Win32 namespace . Register class is used to manipulate the system registry. It represents a Key level node in the windows registry.The registry acts as information for the operating system and application on a computer. Register keys are the base unit of registry. Each key have multiple values alone with it.
For creation of new subkey under the registry, we are using CreateSubKey method to creates a new subkey or opens an existing subkey for write access.
RegistryKey key; key = Registry.CurrentUser.CreateSubKey("Anupam Software"); // you can change root directory e.g. LocalMachine key.SetValue("Anupam", "My Software"); key.Close();
It will create a subkey under the current User(HKEY_USERS) like below screen :
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Can you answer this question?
Write Answer1 Answers