According to the needs of a netizen, I wrote the following to get a list of software installed on the local machine. I hope it will help anyone who needs it.
Using Microsoft. Win32;
Using (registrykey key = Microsoft. win32.registry. localmachine. opensubkey (@ "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall", false) {If (key! = NULL) {foreach (string keyname in key. getsubkeynames () {using (registrykey key2 = key. opensubkey (keyname, false) {If (key2! = NULL) {string softwarename = key2.getvalue ("displayname ",""). tostring (); string installlocation = key2.getvalue ("installlocation ",""). tostring (); If (! String. isnullorempty (installlocation) {This. textbox1.appendtext (string. format ("software name: {0} -- installation path: {1} \ r \ n", softwarename, installlocation ));}}}}}}
Put the obtained result into textbox1 and display it with one row.