C# registry read-write


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Put this at top
  2. using Microsoft.Win32;
  3.  
  4. Read key
  5. RegistryKey regKey1 = Registry.LocalMachine.OpenSubKey("SOFTWARE\\test\\Preferences");
  6. string test = (string)regKey1.GetValue ("TestProperty");
  7.  
  8. Write key
  9. RegistryKey masterKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\\test\\Preferences");
  10.  
  11. masterKey.SetValue("TestProperty", "32");
  12.  
  13. masterKey.Close();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.