Represents a key level node in the Windows registry. This class is a registry encapsulation.
For a list of all members of this type, see RegistryKey Members.
System.Object
System.MarshalByRefObject
Microsoft.Win32.RegistryKey
[Visual Basic] NotInheritable Public Class RegistryKey Inherits MarshalByRefObject Implements IDisposable [C#] public sealed class RegistryKey : MarshalByRefObject, IDisposable [C++] public __gc __sealed class RegistryKey : public MarshalByRefObject, IDisposable [JScript] public class RegistryKey extends MarshalByRefObject implements IDisposable
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.
The registry acts as a central repository of information for the operating system and the applications on a computer. The registry is organized in a hierarchical format, based on a logical ordering of the elements stored within it (please see Registry for the base-level items in this hierarchy). When storing information in the registry, select the appropriate location based upon the type of information being stored. Be sure to avoid destroying information created by other applications, since this can cause those applications to exhibit unexpected behavior, and can also have an adverse effect upon your own application.
RegistryKeys are the base unit of organization in the registry, and can be compared to folders in Windows Explorer. A particular key can have subkeys (just as a folder can have subfolders), and can be deleted, as long as the user has the appropriate permissions to do so, and the key is not a base key, or the level directly under the base keys. Each key can also have multiple values associated with it (a value can be compared to a file), which are used to store the information about the application you are interested in. Each value holds one particular piece of information, which can be retrieved or updated when required. For instance, you can create a RegistryKey for your company (under the key HKEY_LOCAL_MACHINE\Software), and then a subkey for each application that your company creates. Each subkey holds the information specific to that application such as color settings, screen location and size, or recognized file extensions.
Note that information stored in the registry is available to other applications and users, and therefore it should not be used to store security, or critical application information.
To get an instance of a RegistryKey, use the static member OpenSubKey, or use the static member of the Registry class.
Namespace: Microsoft.Win32
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Mscorlib (in Mscorlib.dll)
RegistryKey Members | Microsoft.Win32 Namespace | Registry | RegistryHive