开发者

Getting a specific branch and all its values in the registry

I want to be able to get all the value pairs under a location in the registry, like:

 RegistryKey printerkey =
                settingsRegKey.OpenSubKey("\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers\\Dev开发者_Go百科Modes2\\Settings");

I can select Registry.LocalSystem, etc, but how do I then get to a specific branch (like above)?

Thanks


Dictionary<string, object> keyValuePairs;
using (var settingsRegKey = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers\\DevModes2\\Settings"))
{
       var valueNames = settingsRegKey.GetValueNames();
       keyValuePairs = valueNames.ToDictionary(name => name, settingsRegKey.GetValue);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜