title: C# Union two lists of objects:
body: <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  
  class Program
  {
      static void Main()
      {
          List&lt;A&gt; l = new List&lt;A&gt;();
          l.Add(new A("q"));
  
          l.Union(new[] {new A("w"), new A("E")}, new AComparer());
  
          Console.Write(l.Count);
      }
  }
  
  public class A
  {
      public String b;
  
      public A(String x)
      {
          b = x;
      }
  }
  
  public class AComparer : IEqualityComparer&lt;A&gt;
  {
      public bool Equals(A x, A y)
      {
          return x != null &amp;&amp; y != null &amp;&amp; x.b.Equals(y.b);
      }
  
      public int GetHashCode(A obj)
      {
          return 0;
      }
  }
  </code></pre>
  
  <p>Unable to figure out how to make the list size go 3? I tried looking up <a href="https://msdn.microsoft.com/en-us/library/bb341731(v=vs.110).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/bb341731(v=vs.110).aspx</a> but unable to figure out if I'm missing anything</p>