title: Using linq to select all values from one column based on a distinct second column
body: <p>Having some issues with this in Linq. I have a list of records as shown below:</p>
  
  <pre><code>var allTeams = new List&lt;AllTeamData&gt;()
  {
      new AllTeamData { Team = "Bengals", Conference = "AFC", ConferenceEmail = "AFC@NFL.COM" },
      new AllTeamData { Team = "Steelers", Conference = "AFC", ConferenceEmail = "AFC@NFL.COM" },
      new AllTeamData { Team = "Patriots", Conference = "AFC", ConferenceEmail = "AFC@NFL.COM" },
      new AllTeamData { Team = "Bills", Conference = "AFC", ConferenceEmail = "AFC@NFL.COM" },
      new AllTeamData { Team = "Dolphins", Conference = "AFC", ConferenceEmail = "AFC@NFL.COM" },
      new AllTeamData { Team = "Lions", Conference = "NFC", ConferenceEmail = "NFC@NFL.COM" },
      new AllTeamData { Team = "Bears", Conference = "NFC", ConferenceEmail = "NFC@NFL.COM" },
      new AllTeamData { Team = "Seahawks", Conference = "NFC", ConferenceEmail = "NFC@NFL.COM" },
      new AllTeamData { Team = "Cardinals", Conference = "NFC", ConferenceEmail = "NFC@NFL.COM" },
      new AllTeamData { Team = "Vikings", Conference = "NFC", ConferenceEmail = "NFC@NFL.COM" }
  };
  </code></pre>
  
  <p>And what I'm trying to do is build a list of records in this form:</p>
  
  <pre><code>public class ConferenceData
  {
      public string Conference { get; set; }
      public string ConferenceEmail { get; set; }
      public List&lt;string&gt; Teams { get; set; }
  }
  </code></pre>
  
  <p>What I'm attempting to do is send an email to the specific conference emails with a list of teams in that particular conference.  This is as far as I've been able to get with my linq query:</p>
  
  <pre><code>var conferences = (from t in allTeams
                             select new ConferenceData
                             {
                                 Conference = t.Conference,
                                 ConferenceEmail = t.ConferenceEmail
                             }).Distinct().ToList();
  </code></pre>
  
  <p>Hopefully this all makes sense.  I'm trying to figure out if I need to put together a nested query to pull all the teams and put them in that object list.  Not sure how to go about that.  Any insight would be wonderful.</p>