title: Lambda to compare two Lists
body: <p>I have 3 lists of type <code>cab</code>.  I need to Compare  <code>listA</code> and <code>listB</code>.  If the <code>Car-number</code> or <code>status</code> in <code>listB</code> is the same as that in <code>listA</code> then I have to add that row in <code>listB</code> to <code>listC' else add it to</code>listA<code>.  I need to perform that same operation for all rows for</code>listB`.  How do I write a lambda on two lists to perform this?</p>
  
  <p>This is the code that I have so far:</p>
  
  <pre><code>public class cab
  {
      public string Name {get;set;}
      public string Desc {get;set;}
      public int Car_number   {get;set;}
      public bool status {get;set;}
  
  }
  cab c1 = new cab() { Name = "Zen",Desc = "äsdasdf",Car_number= "8832",status="false"};
  cab c2 = new cab() { Name = "Ford",Desc = "sdfgedasdf",Car_number= "1132",status="true"};
  cab c3 = new cab() { Name = "Swift",Desc = "sdsdf",Car_number= "732",status="true"};
  
  List&lt;cab&gt; listA = new List&lt;cab&gt;();
  
  listA.Add(c1);
  listA.Add(c2);
  listA.Add(c3);
  
  
  List&lt;cab&gt; listB  = new List&lt;cab&gt;();
  cab c4 = new cab() { Name = "Santro",Desc = "iisdasdf",Car_number= "8832",status="false"};
  cab c5 = new cab() { Name = "Ritz",Desc = "esddf",Car_number= "132",status="true"};
  
  listB.Add(c4);
  listB.Add(c5);
  List&lt;cab&gt; listC  = new List&lt;cab&gt;();
  </code></pre>