title: LINQ joining values from different classes
body: <p>I am new to LINQ and sorry if my question have been asked</p>
  
  <p>I have 2 classes</p>
  
  <pre><code>public class Person
  {
      int ID {get;set;}
      string FirstName {get;set;}
      string LastName {get;set;}
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class House
  {
      int ID {get;set;}
      string Address {get;set;}
      string ZipCode {get;set;}
      int PersonId {get;set;}
  }
  </code></pre>
  
  <p>I am saving the list of houses in a IEnumerable List</p>
  
  <pre><code>IEnumerable&lt;House&gt; ListHouses = GetAllHouses();
  </code></pre>
  
  <p>GetAllHouses return the list of houses from the database</p>
  
  <p>I want to use Lamda select in LINQ in order to do the following</p>
  
  <pre><code>var st = ListHouses .Select(h =&gt; new
  {
      id = h.ID,
      Address= h.Address,
      Zip= h.ZipCode ,
      PersonFirstName = GetPersonByID(h.PersonId ).FirstName, 
      PersonLastname = GetPersonByID(h.PersonId ).lastname
  
  });
  </code></pre>
  
  <p>Where GetPersonByID returns an object of Type <code>Person</code> that has the given ID. and then I take his first name and last name.</p>
  
  <p>My question is this:</p>
  
  <p>Instead of Getting the Person 2 times for the variables (personFirstName and PersonLastName) Is there a way I can get it one time and then used it. Something like</p>
  
  <pre><code>PersonForId = GetPersonByID(h.PersonId)
  PersonFirstName =  PersonLastName.FirstName,
  PersonLastname = PersonLastName.lastname
  </code></pre>
  
  <p>I'm looking for something similar to Join in SQL where you join a value from another table.</p>
  
  <p>Thanks you very much for any help</p>