title: Linq compare lists for equality and greater than
body: <p>I am trying to compare 2 lists using csharp and linq</p>
  
  <p>typical scenarios i am trying to pull are</p>
  
  <ol>
  <li>check if values in first list are equal to values in second list. if not what are differences. (Tried with intersect in linq and failed)</li>
  <li><p>check if values in second list are greater than values in first list ie., first list = second list and second list have extra values than first list.</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          List&lt;Student&gt; studentsSrcList = new List&lt;Student&gt;();
  
          Student s1 = new Student();
          s1.Name = "john1";
          s1.Address = "milwaukee1";
          s1.Phone = 1061;
  
          studentsSrcList.Add(s1);
  
          Student s2 = new Student();
          s2.Name = "john2";
          s2.Address = "milwaukee2";
          s2.Phone = 1062;
  
          studentsSrcList.Add(s2);
  
          List&lt;Student&gt; studentDestinationList = new List&lt;Student&gt;();
  
          Student s3 = new Student();
          s3.Name = "john1";
          s3.Address = "milwaukee1";
          s3.Phone = 1061;
  
          studentDestinationList.Add(s3);
  
          Student s4 = new Student();
          s4.Name = "john3";
          s4.Address = "milwaukee2";
          s4.Phone = 1064;
  
          studentDestinationList.Add(s4);
  
          Student s5 = new Student();
          s5.Name = "john5";
          s5.Address = "milwaukee5";
          s5.Phone = 1065;
  
          studentDestinationList.Add(s5);
  
          var diff = studentDestinationList.Intersect(studentsSrcList);
      } 
  }   
  
  class Student
  {
      public string Name { get; set; }
      public string Address { get; set; }
      public int Phone { get; set; }
  }
  </code></pre></li>
  </ol>
  
  <p>I also tried var diff = studentsSrcList.SequenceEqual(studentsDestinationList);</p>