Read a Registry Key

前端 未结 5 2122
傲寒
傲寒 2020-12-03 01:44

I have a web application which is importing DLLs from the bin folder.

const string dllpath = \"Utility.dll\";

    [DllImport(dllpath)]

Now

5条回答
  •  日久生厌
    2020-12-03 01:55

    try
    {
        RegistryKey regKey = Registry.LocalMachine;
        regKey = regKey.OpenSubKey(@"Software\Application\");
    
        if (regKey != null)
        {
            return regKey.GetValue("KEY NAME").ToString();
        }
        else
        {
            return null;
        }
    }
    catch (Exception ex)
    {
      return null;
    }
    

提交回复
热议问题