title: LINQ JOIN Child Collection
body: <p>I have a <code>meetingRepository</code> class that returns IEnumerable and an <code>attendeeRepository</code> class that returns <code>IEnumerable&lt;Attendee&gt;</code></p>
  
  <pre><code>public class meetingRepository
  {
      IEnumerable&lt;Meeting&gt; GetAll()
      {
          //return all Meetings
      }
  }
  
  public class attendeeRepository
  {
      IEnumerable&lt;Attendee&gt;GetAll()
      {
          //return all Attendees
      }
  }
  
  
  public class Meeting
  {
      public int Id { get; set; }
      public DateTime Date { get; set; }
      public string FilePath { get; set; }
      public int Duration { get; set; }
  
      public IEnumerable&lt;Attendee&gt; Attendees { get; set; }
  }
  
  public class Attendee
  {
      public int Id { get; set; }
      public int MeetingId { get; set; }
      public string Name { get set;}
      public string Role { get; set; }
  }
  </code></pre>
  
  <p>Im struggling to come up with the link statement that will join my <code>IEnumerable&lt;Meeting&gt;</code> object with my <code>IEnumerable&lt;Attendee&gt;</code> joining each <code>Attendee</code> in the <code>Attendees</code> property of the <code>Meeting</code> to its related <code>Attendee</code> object based on the <code>Attendee.Id</code></p>
  
  <p>Help appreciated</p>
  
  <p><strong>Edit</strong></p>
  
  <p>@Thomas the meetingRepository I have available does not load the Attendees, it is just a full list of all Meetings (I editted to include the Id property).<br>
  So, to clarify, my meetingRepository returns an IEnumerable of a partial Meeting object (no attendees)</p>
  
  <pre><code>Id
  Date
  Duration
  FilePath 
  </code></pre>
  
  <p>and my attendeeRepository returns an IEnumerable of participants (editted to include MeetingId</p>
  
  <pre><code>Id
  MeetingId
  Name
  Role
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>I came up with the folowing that seems to work fine</p>
  
  <pre><code>var meetingsFull = from m in meetings
                      join a in attendees
                      on m.Id equals a.MeetingId into ma
                      select new Meeting
                      {
                          Id=pc.Id, 
                          Date=pc.Date, 
                          Duration=pc.Duration, 
                          FilePath=pc.FilePath, 
                          Attendees=ma
                      };
  </code></pre>