title: Linq on nested lists c#
body: <p>I have a hierarchy that looks like this:</p>
  
  <pre><code>public class GetCategoriesReply : BaseReply
  {
      public IEnumerable&lt;Subsystem&gt; Categories { get; set; }
  }
  public class Subsystem
  {
      public IEnumerable&lt;cat1&gt; cat1 { get; set; }
      public string id { get; set; }
      public string name { get; set; }
  }
  public class cat1
  {
      public IEnumerable&lt;cat2&gt; cat2 { get; set; }
      public string id { get; set; }
      public string name { get; set; }
  
  }
  public class cat2
  {
      public IEnumerable&lt;cat3&gt; cat3 { get; set; }
      public string id { get; set; }
      public string name { get; set; }
  
  }
  public class cat3
  {
      public string id { get; set; }
      public string name { get; set; }
  
  }
  </code></pre>
  
  <p>I would like to get the list of Cat3 out from the query if possible.
  I have tried this but don't get it to work :</p>
  
  <pre><code>var cat3list = categoryList.Categories
              .Where(s =&gt; s.name == "Payment")
              .Select(x =&gt; x.cat1.Where(c =&gt; c.name == "Admin").SelectMany(y =&gt; y.cat2.Select(z =&gt; z.cat3))
              .ToList());
  </code></pre>
  
  <p>Any suggestions?
  Kind regards 
  /Rudy </p>