Development Class C#

using System;
using Microsoft.Win32;
class Class1 {
    static void Main(string[] args) {
        RegistryKey myRegKey = Registry.LocalMachine;
        myRegKey = myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
        String[] subkeyNames = myRegKey.GetSubKeyNames();
        foreach (String s in subkeyNames) {
            RegistryKey UninstallKey = Registry.LocalMachine;
            UninstallKey = UninstallKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + s);
            try {
                Object oValue = UninstallKey.GetValue("DisplayName");
                Console.WriteLine(oValue.ToString());
            } catch (NullReferenceException) {
            }
        }
    }
}