does Registry.CurrentUser.OpenSubKey create the key if it does not exist? code example
Example: does Registry.CurrentUser.OpenSubKey create the key if it does not exist?
public void ConfigureWindowsRegistry()
{
RegistryKey localMachine = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
var reg = localMachine.OpenSubKey("Software\\Microsoft\\Office\\Outlook\\FormRegions\\tesssst",true);
if (reg == null)
{
reg = localMachine.CreateSubKey("Software\\Microsoft\\Office\\Outlook\\FormRegions\\tesssst");
}
if (reg.GetValue("someKey") == null)
{
reg.SetValue("someKey", "someValue");
}
}