Working with Windows Registry in C# - The Basics (Page 2 of 5 )
Before we begin, I'd like to point something out: during this tutorial, I will assume that you, the reader, are already familiar with the Windows registry and know most of its "inner workings." Going over details to describe its structure is beyond the scope of this article. Therefore, we are just going to remind ourselves of its structure in a nutshell.
The Windows registry contains the following two elements: keys and values. Each of the keys can also have values and subkeys. Keys act like folders (branches) from an analogical perspective, while values are name-data pairs that actually contain data on their data part. The entire registry is split into various sections that are called hives.
Let's refresh our memory, in case we've forgotten their full or abbreviated names:
Ø HKCR -- HKEY_CLASSES_ROOT
Ø HKCU -- HKEY_CURRENT_USER
Ø HKLM -- HKEY_LOCAL_MACHINE
Ø HKU -- HKEY_USERS
Ø HKCC -- HKEY_CURRENT_CONFIG

The time couldn't be better for you to launch the Windows Registry Editor (regedit.exe or regedt32.exe) and go over it. Due to the nature of this tutorial, we cannot move on before I suggest that you back up your registry. Once this step is done and you are familiar with its structure, you should be prepared.
It would be very useful for you to create a test key with test values somewhere deep in the hierarchy of the registry. For the purpose of this article, I have created the following subkey: "HKCUSoftwareTutorial" and there I have created a few string values, such as "DS" - "Developer Shed" and "DA" - "Dev Articles."
That's all great. I am sure you have guessed that we are going to work with these values throughout this article. So once you have created the appropriate subkey and string values and your registry is backed up (but we won't do any harm anyway) then please head on to the next page.
Next: Let's Do It! >>
More C# Articles
More By Barzan "Tony" Antal