// Open the key from the specified location
RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software", true);
// Create a new key to store your value
RegistryKey NameKey = SoftwareKey.CreateSubKey("keyName");
// Set the key value
NameKey.SetValue("yourvalue");