1 public bool IsRegistered() 2 { 3 string clsid = ConfigurationManager.AppSettings["clsid"]; 4 //参数检查 5 Debug.Assert(!String.IsNullOrEmpty(clsid), "clsid 不应该为空"); 6 //设置返回值 7 bool result = false; 8 //检查方法,查找注册表是否存在指定的clsid 9 string key = $@"CLSID\{{{clsid}}}"; 10 RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(key); 11 if (regKey != null) 12 { 13 result = true; 14 } 15 return result; 16 }logs_code_collapse">View Code