title: Linq .Except function "At least one object must implement IComparable."
body: <p>Basically i have a container which implements IEquatable (sample shown below)</p>
  
  <pre><code>public class ContainerClass  : IEquatable&lt;ContainerClass&gt;
  {
          public IEnumerable&lt;CustomClass&gt; CustomClass { get; set; }
  
          public override bool Equals(object obj) { ... }
          public bool Equals(ContainerClass other) { ... }
          public static bool operator ==(ContainerClass cc1, ContainerClass cc2) { ... }
          public static bool operator !=(ContainerClass cc1, ContainerClass cc2) { ... }
          public override int GetHashCode() { ... }
  }
  </code></pre>
  
  <p>and a CustomClass which also implements IEquatable</p>
  
  <pre><code>public class CustomClass : IEquatable&lt;CustomClass&gt;
  {
          public string stringone { get; set; }
          public string stringtwo { get; set; }
  
          public override bool Equals(object obj) { ... }
          public bool Equals(CustomClass other) { ... }
          public static bool operator ==(CustomClass cc1, CustomClass cc2) { ... }
          public static bool operator !=(CustomClass cc1, CustomClass cc2) { ... }
          public override int GetHashCode() { ... }
  }
  </code></pre>
  
  <p>All this is working fine, so for example, the following works</p>
  
  <pre><code>IEnumerable&lt;CustomClass&gt; customclassone = new List&lt;CustomClass&gt;
      {
          new CustomClass { stringone = "hi" },
          new CustomClass { stringone = "lo" }
      };
  IEnumerable&lt;CustomClass&gt; customclasstwo = new List&lt;CustomClass&gt;
      {
          new CustomClass { stringone = "hi" }
      };
  
  var diff = customclassone.Except(customclasstwo);
  
  ContainerClass containerclassone = new ContainerClass 
  {
      CustomClass = customclassone.AsEnumerable()
  };
  ContainerClass containerclasstwo = new ContainerClass 
  {
      CustomClass = customclasstwo.AsEnumerable()
  };
  
  var diff2 = containerclassone.CustomClass.Except(customclasstwo.CustomClass);
  </code></pre>
  
  <p>After this code both diff and diff2 when enumerated contain the expected results. However, if i then try</p>
  
  <pre><code>IEnumerable&lt;CustomClass&gt; oldCustom = oldContainerClass.CustomClass;
  IEnumerable&lt;CustomClass&gt; newcustom = newContainerClass.CustomClass;
  var exceptlist = oldCustom.Except(newcustom);
  </code></pre>
  
  <p>When i try to enumerate the exceptlist i get "At least one object must implement IComparable.". The only difference between oldCustom and newCustom from the ones in the above working examples is the way they are populated. Anyone got any idea why this is happening?</p>