This might be a trivial question, but I didn't find any information about this: is it "harmful" or considered bad practice to make a type T implement IComparable<S>
(T and S being two different types)?
Example:
class Foo : IComparable<int>
{
public int CompareTo(int other)
{
if (other < i) return -1;
if (other > i) return 1;
return 0;
}
private int i;
}
Should this kind of code be avoided, and if yes, why?