So, I used RegEdit to add the following to the registry of my workstation:
HKLM \ Software \ Foo \ Bar
The bar has a pair k / v "wtf" / "idk". I confirmed that these changes were "accepted" by closing regedit and reopening it. Hey, they are still there! Swell
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Foo\Bar"); if (key != null) { var = key.GetValue("wtf").ToString(); }
The problem is that the key is null.
When.,.
Registry.LocalMachine.OpenSubKey("Software").GetSubKeyNames()
Called, Foo is not displayed among the many SubKeyNames.
So, I obviously miss something stupid. What exactly am I missing?
c # registry
peacedog
source share