using Microsoft.Win32;
/// <summary> /// 写入注册表 /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <returns></returns> public bool SetAppkey(string name, string value) { RegistryKey Rootkey = Registry.LocalMachine; RegistryKey Appkey = Rootkey.CreateSubKey(@"SOFTWARE\text"); Appkey.SetValue(name, value); return true; } /// <summary> /// 读取注册表 /// </summary> /// <param name="name"></param> /// <returns></returns> public string GetAppkey(string name) { RegistryKey Rootkey = Registry.LocalMachine; RegistryKey Appkey = Rootkey.OpenSubKey(@"SOFTWARE\text"); return Appkey.GetValue(name).ToString(); }