引用 micrisoft.win32
里面有注册表的相关操作.
RegistryKey hklm = Registry.LocalMachine;
RegistryKey hksf = hklm.OpenSubKey("software",true);//打开software项并可写
RegistryKey hkser = hksf.CreateSubKey("keyname",RegistryKeyPermissionCheck.Default);//创建注册表值
hkser.SetValue("autorun", autoRun ? 1 : 0);//设置值