C# 如何操作注册表

来源:百度知道 编辑:UC知道 时间:2024/07/04 06:44:51
我登录到某个系统时.编辑一个数组时.
想将登录名 和 编辑后的数组 信息绑定到一起 写入注册表
在下次登录时.看注册表是否存在改用户的信息.有的话.就将对应的数组信息显示出来.

using Microsoft.Win32;

使用Registry.SetValue()方法向注册表中写入值
使用Registry.GetValue()方法从注册表中读取值

using Microsoft.Win32;
RegistryKey pregkey;
pregkey = Registry.LocalMachine.OpenSubKey("SYSTEM", true).OpenSubKey("ControlSet001", true).OpenSubKey("Control", true).OpenSubKey("Session Manager", true).OpenSubKey("Environment", true);