gpt4 book ai didi

c# - Registry.GetValue() 和 Registry.User.GetValue() 的不同结果

转载 作者:行者123 更新时间:2023-11-30 16:21:21 27 4
gpt4 key购买 nike

我在 output1output2 中得到了不同的结果。第一个给了我在注册表中实际看到的值,而后者只给了我默认值。我想念什么?

String output1 = Registry.GetValue(
@"HKEY_USERS\blobb", "beep", "nope!") as String;

String output2 = Registry.Users.GetValue(
@"blobb\beep", "nope!") as String;

我已经尝试了很多不同的输入字符串变体,但没有一个给我正确的值。

最佳答案

Registry.Users.GetValue 正在根 USERS 键中查找名为“blobb\beep”的值

要获得与第一个示例相同的结果,您需要类似的东西

using (var blobb = Registry.Users.OpenSubKey("blobb"))
{
String output2 = blobb.GetValue("beep", "nope!") as String
}

关于c# - Registry.GetValue() 和 Registry.User.GetValue() 的不同结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13290498/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com