title: where condition inside nested list linq
body: <p>I have two classes </p>
  
  <pre><code>  public class Item
    {
      public string LineID{ get; set; }
      public string ItemNo{ get; set; }
      public List&lt;Itemcode&gt; ItemcodeList{ get; set; }
    }
  
    public class Itemcode
     {
        public string LineID{ get; set; }
        public string code { get; set; }
        public string codeValue { get; set; }
     }
  </code></pre>
  
  <p>and two datatables ds.Tables[1] and ds.Tables[2] </p>
  
  <p>I am converting the data from two dataset into list of Item class which also contains List of Itemcode class </p>
  
  <p>What I am doing is as follows </p>
  
  <pre><code> List&lt;Item&gt; items = ds.Tables[1].AsEnumerable().Select(dataRow =&gt; new Item
                      {
                          LineID= Convert.ToString(dataRow.Field&lt;int&gt;("LineID")),
                          ItemNo= dataRow.Field&lt;string&gt;("ItemNo"),
                          ItemcodeList = ds.Tables[2].AsEnumerable().Select(row =&gt; new Itemcode
                          {
                              code= Convert.ToString(row.Field&lt;string&gt;("code")),
                              codeValue = Convert.ToString(row.Field&lt;string&gt;("codeValue")),
                          }).ToList()
                      }).ToList();
  </code></pre>
  
  <p>The above code gives the all ds.Tables[2] rows against each row of ds.Table[1] </p>
  
  <p>But I want only those rows where LineID of ds.Table[1] match with LineID of ds.Table[2] where I have to change condition</p>