Since its introduction in Windows 95, the registry has more often than not intimidated developers. The registry acts as a central repository of information for the operating system and the applications on a computer. When you store information in the registry, choose the appropriate location based on the category of information being stored.
Here is how to write and read from the registry using C#.
// i.e : string myValue = readFromRegistry("Software\\Myapp","TheKey","TheValue");
public static void saveToRegistry(string subkey, string key , string value) {
// Save user prefs to reg.
RegistryKey regKey = Registry.CurrentUser;
regKey = regKey.CreateSubKey(subkey);
regKey.SetValue(key, value);
}
// i.e : string myValue = readFromRegistry("Software\\Myapp","Thisthekey");
public static String readFromRegistry(string subkey, string key){
// Retrieve user prefs from reg
RegistryKey regKey = Registry.CurrentUser;
regKey = regKey.CreateSubKey(subkey);
return (string)regKey.GetValue(key, "");
}
Find out more :MSDN Microsoft