title: How to compare two List content data and return mismatch value?
body: <p>I have two List. Which content simple string values. As example:</p>
  
  <p>IList1 content:</p>
  
  <ul>
  <li>The Avengers</li>
  <li>Shutter Island</li>
  <li>Inception</li>
  <li>The Dark Knight Rises</li>
  </ul>
  
  <p>List2 content:</p>
  
  <ul>
  <li>The Avengers</li>
  <li>Shutter Island</li>
  <li>Inception</li>
  <li>The Dark Knight Rises</li>
  <li>Parks and Recreation</li>
  <li>Scandal</li>
  </ul>
  
  <p>I want to compare two list and it will return mismatch value. Like in this case it will return "Parks and Recreation" and "Scandal" as they are not matching with the values of List1.</p>
  
  <p>I tried it. But it throws exception "Object reference not set to an instance of an object".</p>
  
  <pre><code>static void Main(string[] args)
      {
          List&lt;string&gt; list1 = new List&lt;string&gt;();
          list1.Add("The Avengers");
          list1.Add("Shutter Island");
          list1.Add("Inception");
          list1.Add("The Dark Knight Rises");
  
          List&lt;string&gt; list2 = new List&lt;string&gt;();
          list2.Add("The Avengers");
          list2.Add("Shutter Island");
          list2.Add("Inception");
          list2.Add("The Dark Knight Rises");
          list2.Add("Parks and Recreation");
          list2.Add("Scandal");    
  
         try
          {
              List&lt;string&gt; difference = Comparator(list1, list2);
              foreach (var value in difference)
              {
                  Console.WriteLine(value);
              }
          }
          catch (System.NullReferenceException e)
          {
              Console.WriteLine(e.Message);    
          }
  
          Console.ReadLine();
  
      }
      public static List&lt;string&gt; Comparator(List&lt;string&gt; list1, List&lt;string&gt; list2)
      {
          IEnumerable&lt;string&gt; differenceQuery = list1.Except(list2);
          List&lt;string&gt; differ = null;
  
          foreach (string s in differenceQuery)
              differ.Add(s);
  
          return differ;
      }
  </code></pre>
  
  <p>Can anyone help me out?
  Thanks in advance.</p>