title: Use of Distinct with list of custom objects
body: <p>How can I make the <code>Distinct()</code> method work with a list of custom object (<code>Href</code> in this case), here is what the current object looks like:</p>
  
  <pre><code>public class Href : IComparable, IComparer&lt;Href&gt;
  {
      public Uri URL { get; set; }
      public UrlType URLType { get; set; }
  
      public Href(Uri url, UrlType urltype)
      {
          URL = url;
          URLType = urltype;
      }
  
  
      #region IComparable Members
  
      public int CompareTo(object obj)
      {
          if (obj is Href)
          {
              return URL.ToString().CompareTo((obj as Href).URL.ToString());
          }
          else
              throw new ArgumentException("Wrong data type.");
      }
  
      #endregion
  
      #region IComparer&lt;Href&gt; Members
  
      int IComparer&lt;Href&gt;.Compare(Href x, Href y)
      {
          return string.Compare(x.URL.ToString(), y.URL.ToString());
      }
  
      #endregion
  }
  </code></pre>