Because many values can be stored in each key in the registry, you must use the name parameter to specify the particular value you want to set.
A registry key can have one value that is not associated with any name. When this unnamed value is displayed in the registry editor, the string "(Default)" appears instead of a name. To set this unnamed value, specify either null or the empty string ("") for name.
In order to set values in a key, you must open the key with write access. After you have opened a key with write access, you can change any of the name/value pairs in that key.
If the specified name does not exist in the key, it is created, and the associated value is set to value.
Specifying the registry data type RegistryValueKind.Unknown is the same as using the RegistryKey.SetValue(string, object) overload.
If the type of the specified value does not match the specified valueKind, and the data cannot be converted, ArgumentException is thrown. For example, you can store a long as a RegistryValueKind.DWord, but only if its value is less than the maximum value of a int. You cannot store a single string value as a RegistryValueKind.MultiString.
If boxed values are passed for RegistryValueKind.DWord or RegistryValueKind.QWord, the conversion is done using the invariant culture.
Do not expose Microsoft.Win32.RegistryKey objects in such a way that a malicious program could create thousands of meaningless subkeys or key/value pairs. For example, do not allow callers to enter arbitrary keys or values.
On Windows 98 and Windows Millennium Edition the registry is not Unicode, and not all Unicode characters are valid for all code pages. A Unicode character that is invalid for the current code page is replaced by the best available match. No exception is thrown.