Nullable Type Comparison

I did some comparison between NULL types when I noticed this:

int? a = null;
int? b = null;
// a == b; ==> true
// a <= b; ==> false

For me, the operator is <=equivalent == OR <, and since a == b- true, I exclude also truefor a <= b.

Not for you too illogical?

Why operators <=and >=have been designed in such a way? Is there any special reason?

+6
source share

Source: https://habr.com/ru/post/1016179/


All Articles