title: Know if Instance returned by Registry Key is Default or Named instance
body: <p>I have this piece of code:</p>
  
  <pre><code>        List&lt;SQLInstancia&gt; list = new List&lt;SQLInstancia&gt;();
          SQLInstancia instancia;
          int cont = 0;
          RegistryView registryView = Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32;
          using (RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, registryView))
          {
              //Instancias en 64bits
              RegistryKey instanceKey = hklm.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL", false);
              //instancias en 32bits
              RegistryKey instanceKey_ = hklm.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server", false);
              if (instanceKey != null)
              {
  
                  foreach (var instanceName in instanceKey.GetValueNames())
                  {
                      cont++;
                      instancia = new SQLInstancia();
                      instancia.Nombre = Environment.MachineName + "\\" + instanceName;
                      instancia.IdInstancia = cont;
                      list.Add(instancia);
                  }
              }
          }
  </code></pre>
  
  <p>With that code I'm getting all of the SQL Server instances running in my local machine, but the thing is that I can't know if it's a default instance or a Named instance.</p>
  
  <p>I've allready tried with SMO and with SqlDataSourceEnumerator.GetDataSources(), the second one worked, but it retrieves all of the instances on the network, and I don't need them, I just need the ones that are on the local machine. With SMO it shows my Named instance, but won't show the default instance. </p>