Can I compare two arbitrary references in a way that can be used in a CompareTo method?
<p>I'm writing an implementation of <code>IComparable&lt;T&gt;.CompareTo(T)</code> for a struct. I'm doing a member-wise comparison (i.e. <code>d = a.CompareTo(other.a); if (d != 0) { return d; }</code> etc.), but one of the members is of a class (let's call it <code>Y</code>) that doesn't implement <code>IComparable</code> or have any other reasonable way of comparing so I just want to compare the references (in this case I know that all instances of <code>Y</code> are unique). Is there a way of doing that that will yield an <code>int</code> that is suitable for use in a comparison method?</p>
