This article example describes how C# obtains software manifest through the windows registry. Share it for your reference. The details are as follows:
foreach (string SoftwareName in ()) { += SoftwareName + ; } //////////////////////////////////////////////////////////////////////// /// <summary> /// Windows system obtains software list/// </summary> /// <returns>String [] softwareList</returns> public String [] SoftwareList() { String[] softwareList = null; //Dynamic array ArrayList list = new ArrayList(); try { //Open the registration list uninstall option //SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall RegistryKey Key = Microsoft.("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"); if (Key != null)//If the system prohibits access, return null { foreach (String SubKeyName in ()) { //Open the corresponding software name RegistryKey SubKey = (SubKeyName); if (SubKey != null) { String SoftwareName = ("DisplayName", "Nothing").ToString(); //If not retrieved, the dynamic array will not be saved if (SoftwareName != "Nothing") { (SoftwareName); } } } //Capt into a string array to prevent the overflow of modified data softwareList = (string[])(typeof(string)); } } catch (Exception err) { ("Error message:" + ()); } return softwareList; }
I hope this article will be helpful to everyone's C# programming.