title: Inheriting the equality comparer
body: <p>I have a Customer class.</p>
  
  <pre><code>public class Customer
  {
      private string _id;
      private string _name;
      // some more properties follow 
  </code></pre>
  
  <p>I am inheriting the EqualityComparer form MyEqualityComparer(of Customer).<br>
  This I am intending to use in LINQ queries.<br>
  MyEqualityComparer is intended for partial check between two objects.<br>
  If the customer.id and customer.name matches I treat the objects the equal. </p>
  
  <pre><code>public class MyComparer : System.Collections.Generic.EqualityComparer&lt;Customer&gt;
  {
      public override bool Equals(Customer x, Customer y)
      {
          if (x.Id == y.Id &amp;&amp; x.Name == y.Name)
              return true;
          else
              return false;
      }
  
      public override int GetHashCode(Customer obj)
      {
          return string.Concat(obj.Id,obj.Name).GetHashCode();
      }
  
  }
  </code></pre>
  
  <p>I referred to  <a href="https://stackoverflow.com/questions/16340/how-do-i-generate-a-hashcode-from-a-byte-array-in-c">generating hashcode</a>.<br>
  I am little unsure about concatenating strings and using that as a hashcode.<br>
  Is this safe and sound what I am trying to do ? </p>