title: query nested objects with LINQ
body: <p>I have an instance object of Division class.</p>
  
  <p>Division object holds a list of Branch objects.<BR>
  Each branch object holds a list of Department objects.<BR>
  Each Department object holds list of Team objects.</p>
  
  <p>just to make it clear I can do that:</p>
  
  <pre><code>int MakeItClear = DivisionObject.ListOfBranches[5]
                                  .ListOfDepartments[4]
                                  .ListOfTeam[3]
                                  .SomeIntegerProperty;
  </code></pre>
  
  <p>Each object has <code>ID</code> and <code>Name</code> properties</p>
  
  <p>My wish is create a function that will return a list of team names by passing a parameter of Branch.ID using LINQ.</p>
  
  <p>basically I want to do that using LINQ:</p>
  
  <pre><code>public static List&lt;string&gt; getBranchTeamNames(ref Sales.Division obj, int BranchID)
  {
      List&lt;string&gt; result = new List&lt;string&gt;();
      foreach (Sales.Branch b in obj.allBranches)
      {
          if (b.branchID == BranchID)
          {
              foreach (Sales.Department d in b.allDepartmentsManagers)
              {
                  foreach (Sales.Team t in d.allTeams)
  
                  {
                      result.Add(t.teamName);
                  }
              }
  
               break;
          }          
      }
      return result;
  }
  </code></pre>
  
  <p>i will be happy for some guidance, does not matter if its c# or vb.net. </p>
  
  <p>thank you for your time and consideration.</p>