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);
}
精彩评论