title: How would I compare two Lists(Of <CustomClass>) in VB?
body: <p>I'm working on implementing the equality operator <code>=</code> for a custom class of mine.  The class has one property, <code>Value</code>, which is itself a <code>List(Of OtherClass)</code>, where <code>OtherClass</code> is yet another custom class in my project.</p>
  
  <p>I've already implemented the <code>IComparer</code>, <code>IComparable</code>, <code>IEqualityComparer</code>, and <code>IEquatable</code> interfaces, the operators <code>=</code>, <code>&lt;&gt;</code>, <code>bool</code> and <code>not</code>, and overriden <code>Equals</code> and <code>GetHashCode</code> for <code>OtherClass</code>.  This should give me all the tools I need to compare these objects, and various tests comparing two singular instances of these objects so far checks out.</p>
  
  <p>However, I'm not sure how to approach this when they are in a <code>List</code>.  I don't care about the list order.  Given:</p>
  
  <pre><code>Dim x As New List(Of OtherClass) From
      {New OtherClass("foo"),
       New OtherClass("bar"),
       New OtherClass("baz")}
  
  Dim y As New List(Of OtherClass) From
      {New OtherClass("baz"),
       New OtherClass("foo"),
       New OtherClass("bar")}
  </code></pre>
  
  <p>Then <code>(x = y).ToString</code> should print out <code>True</code>.</p>
  
  <p>I need to compare the same (not distinct) set of objects in this list.  The list shouldn't support dupes of <code>OtherClass</code>, but I'll have to figure out how to add that in later as an exception.  Not interested in using LINQ.  It looks nice, but in the few examples I've played with, adds a performance overhead in that bugs me.  Loops are ugly, but they are fast :)</p>
  
  <p>A straight code answer is fine, but I'd like to understand the logic needed for such a comparison as well.  I'm probably going to have to implement said logic more than a few times down the road.</p>