Steps to follow :
- Copy the code and paste it into the Main method of a console application.
- Replace the Names parameter with the name of a key that exists directly under the HKEY_CURRENT_USER node of the registry.
- Replace the Name parameter with the name of a value that exists directly under the Names node.
It is more secure to write data to the user folder — Microsoft.Win32.Registry.CurrentUser — rather than to the local computer — Microsoft.Win32.Registry.LocalMachine.