Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an interface that enables > < and all the other comparison operators?

Tags:

People also ask

Can interface contain operators?

You can't define operators on interfaces because a class can implement multiple interfaces.

How many comparison operators are there?

There are four types of operators that can be used in expressions: comparison.

Which operators are also known as comparison operators?

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.