This class is the starting point when using the Windows registry, which is the central repository used by most Windows applications for storing user-specific settings and preferences. Each static field of this class represents a root RegistryKey object, which has values and multiple levels of subkeys. These keys are read-only, but can be manipulated using the methods of the RegistryKey class.

Most applications store their settings in CurrentUser (HKEY_CURRENT_USER). The recommended standard is to use the Software subkey, create a subkey for your organization, and then create a subkey for each specific application (for example, Internet Explorer preferences are stored in HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer). Analogous global settings that should affect all users on the current computer can be placed in a similar subkey in LocalMachine (HKEY_LOCAL_MACHINE). For example, setup programs often use this key to store information about installed applications. The full collection of user settings for all the users of the current computer can be retrieved from the Users key, as can the default settings for new users, which are contained in the .DEFAULT subkey of users. CurrentUser is actually a mapped subkey of Users, much as CurrentConfig is a subkey of LocalMachine.

The ClassesRoot key contains information used for Windows 3.1-compatible DDE and OLE support. Information for file viewers, Windows Explorer extensions, and file associations is also stored ...

Get C# in a Nutshell, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.