You can't define operators on interfaces because a class can implement multiple interfaces.
There are four types of operators that can be used in expressions: comparison.
The < (less than), > (greater than), <= (less than or equal), and >= (greater than or equal) comparison, also known as relational, operators compare their operands. Those operators are supported by all integral and floating-point numeric types.
I'm mucking about, making a generic class, and all this time I thought using types that implemented IComparable
enabled using the comparison operators.
I know .CompareTo()
can perform functionally the same operations, but I have a nagging feeling that there must be an interface that implements the comparison operators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With