public int Compare(TypeDesc x, TypeDesc y) { if (x == y) { return(0); } int codeX = x.ClassCode; int codeY = y.ClassCode; if (codeX == codeY) { Debug.Assert(x.GetType() == y.GetType()); int result = x.CompareToImpl(y, this); // We did a reference equality check above so an "Equal" result is not expected Debug.Assert(result != 0); return(result); } else { Debug.Assert(x.GetType() != y.GetType()); return(codeX > codeY ? -1 : 1); } }