c# - Can I compare two arbitrary references in a way that can be used in a CompareTo method? -
i'm writing implementation of icomparable<t>.compareto(t)
struct. i'm doing member-wise comparison (i.e. d = a.compareto(other.a); if (d != 0) { return d; }
etc.), 1 of members of class (let's call y
) doesn't implement icomparable
or have other reasonable way of comparing want compare references (in case know instances of y
unique). there way of doing that yield int
suitable use in comparison method?
it's not meaningful compare references looking order relationships. it's meaningful equality.
Comments
Post a Comment