Should I implement both IComparable
and the generic IComparable<T>
? Are there any limitations if I only implement one of them?
Yes, you should implement both.
If you implement one, any code that depends on the other will fail.
There is lots of code that uses either IComparable
or IComparable<T>
but not both, so implementing both ensure your code will work with such code.