title: Why do I get System.Collections.Generic.Dictionary`2 when writing to a StreamWriter?
body: <p>I have this code:</p>
  
  <pre><code>        Console.Title = "System Reader";
          Console.WriteLine("Enter the Domain-Address &lt;or local&gt;:");
          string domain = Console.ReadLine();
          Console.Clear();
          string date = DateTime.Now.ToString("yyyy-MM-dd");
          string time = DateTime.Now.ToString("HH-mm-ss");
          double count = 1;
          string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "user_" + domain + "_" + date + "_" + time + ".txt");
          string ComputerName = Environment.MachineName;
          Console.Clear();
          if (domain == "local")
          {
              ObjectQuery user = new ObjectQuery("SELECT * FROM Win32_UserAccount WHERE LocalAccount = True");
              ManagementObjectSearcher userSearcher = new ManagementObjectSearcher(user);
              TextWriter tw = new StreamWriter(path);
              tw.Write("Account Type" + "\t" + "Caption" + "\t" + "Description" + "\t" + "Disabled" + "\t" + "Domain" + "\t" + "Full Name" + "\t" + "Local Account" + "\t" + "Lockout" + "\t" + "Name" + "\t" + "Password Changeable" + "\t" + "Password Expires" + "\t" + "Password Required" + "\t" + "SID" + "\t" + "SID Type" + "\t" + "Status" + "\t");
              for (int i = 0; i &lt; 10; i++)
              {
                  tw.Write("Group" + (i + 1) + "\t");
              }
              tw.WriteLine("");
  
              foreach (ManagementObject userObj in userSearcher.Get())
              {
                  tw.WriteLine(userObj["AccountType"] + "\t" + userObj["Caption"] + "\t" + userObj["Description"] + "\t" + userObj["Disabled"] + "\t" + userObj["Domain"] + "\t" + userObj["FullName"] + "\t" + userObj["LocalAccount"] + "\t" + userObj["Lockout"] + "\t" + userObj["Name"] + "\t" + userObj["PasswordChangeable"] + "\t" + userObj["PasswordExpires"] + "\t" + userObj["PasswordRequired"] + "\t" + userObj["SID"] + "\t" + userObj["SIDType"] + "\t" + userObj["Status"]);
                  Dictionary&lt;string, string&gt; LocalGroups = new Dictionary&lt;string, string&gt;();
                  ManagementObjectSearcher groupSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Group WHERE LocalAccount = TRUE");
                  foreach (ManagementObject groupObj in groupSearcher.Get())
                  {
                      ManagementObjectSearcher linkSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_GroupUser Where GroupComponent = \"Win32_Group.Domain=\'" + ComputerName + "\',Name=\'" + groupObj["Name"] + "\'\"");
                      foreach (ManagementObject linkObj in linkSearcher.Get())
                      {
                          string UName = linkObj["PartComponent"].ToString();
                          UName = UName.Substring(UName.IndexOf("=") + 1);
                          string Domain = UName.Substring(0, UName.IndexOf((","))).Replace("\"", "");
                          UName = UName.Substring(UName.IndexOf("=") + 1).Replace("\"", "");
                          if (UName.IndexOf(userObj["Name"].ToString(), 0, StringComparison.OrdinalIgnoreCase) == 0)
                              LocalGroups.Add(groupObj["Name"].ToString(), Domain + "\\" + UName);
                          tw.WriteLine(LocalGroups);
                      }
                  }
              }
              tw.Close();
              TextReader tr = new StreamReader(path);
              Console.WriteLine(tr.ReadToEnd());
              tr.Close();
              Console.Write("\nPress Enter to exit ...");
              Console.Read();
          }
      }
  }
  </code></pre>
  
  <p>But the output is only <code>System.Collections.Generic.Dictionary2[System.String,System.String]</code>
  and not the group name from the user.</p>
  
  <p>Does someone know what the problem is?</p>
  
  <p>P.S this code should be for local.</p>