title: How do I put distinct values from a LINQ query into a list?
body: <p>I've looked at several answers to similar questions, but none of them solve my problem. All I need to do is get distinct values from a LINQ query (that queries a XML file) and put them into a list. Here is what I have tried: </p>
  
  <pre><code> var XmlData = XDocument.Load("PathToFile");
      List&lt;string&gt; XmlItems = new List&lt;string&gt;();
  
      var XQuery = from m in XmlData.Root.Elements()
                   where m.Attribute("Category").Value.ToString().Equals("TheCategory")
                   select (m.Attribute("TheAttribute").Value).Distinct().ToString();
  
      XmlItems.AddRange(XQuery);
  
      foreach (var item in XmlItems)
      {
          ComboBoxTeams.Items.Add(item);
      }
  </code></pre>
  
  <p>The <code>Distinct()</code> function call is not giving the expected result. I'm unfamiliar with how to get distinct values from a LINQ query. Any suggestions?</p>