.NET Framework Class Library  

Registry Class

Supplies the base Registrykeys that access values and subkeys in the registry.

For a list of all members of this type, see Registry Members.

System.Object
   Microsoft.Win32.Registry

[Visual Basic]
NotInheritable Public Class Registry
[C#]
public sealed class Registry
[C++]
public __gc __sealed class Registry
[JScript]
public class Registry

Thread Safety

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.

Remarks

This class provides the set of standard root keys found in the registry on machines running Windows. The registry is a storage facility for information about applications, users, and default system settings. For example, applications can use the registry for storing information that needs to be preserved once the application is closed, and access that same information when the application is reloaded. For instance, you can store color preferences, screen locations, or the size of the window. You can control this for each user by storing the information in a different location in the registry.

The base (root) RegistryKey instances that are exposed by Registry delineate the basic storage mechanism for subkeys and values in the registry. The keys are all readonly since the registry depends on their existence. The keys exposed by Registry are:

CurrentUser
Stores information about user preferences.
LocalMachine
Stores configuration information for the local machine.
ClassesRoot
Stores information about types (and classes) and their properties.
Users
Stores information about the default user configuration.
PerformanceData
Stores performance information for software components.
CurrentConfig
Stores non-user-specific hardware information.
DynData
Stores dynamic data.

Once you have identified the root key under which you want to store/retrieve information from the registry, you can use the RegistryKey class to add or remove subkeys, and manipulate the values for a given key.

Hardware devices can place information in the registry automatically using the Plug and Play interface. Software for installing device drivers can place information in the registry by writing to standard APIs.

Requirements

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)

See Also

Registry Members | Microsoft.Win32 Namespace | RegistryHive | RegistryKey