![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
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 }