[C#] 读写注册表

RegistryKey   rkey   =   Registry.LocalMachine;  
  //The   second   parameter   tells   it   to   open   the   key   as   writable  
          RegistryKey rkey1   =   rkey.OpenSubKey("Software",true);  
  RegistryKey   rkey2   =   rkey1.CreateSubKey("baoTest");  
  rkey2.SetValue("Name",textBox1.Text);  
  rkey2.Close();  
  rkey1.Close();  
  读:  
  RegistryKey   rkey   =   Registry.LocalMachine;  
  //The   second   parameter   tells   it   to   open   the   key   as   writable  
  RegistryKey rkey1   =   rkey.OpenSubKey("Software\\baoTest",true);  
  textBox2.Text=rkey1.GetValue("Name").ToString();  
-----
原文地址:https://www.cnblogs.com/boneking/p/1731522.html