I know I'm late, but I'll drop my two cents.
If memory is used, the rules for comparison are as follows:
- If x and y are zero, return 0 (they are equal).
- If x is null and y is not, return -1 (x is less than y).
- If x is not null and y is null, return 1 (x is greater than y).
For all non-empty values:
- When the value of x is evaluated less than y, return -1.
- When the value of x evaluates y, return 0.
- When x is greater than y, return 1.
For all purposes, Nullable <T> evaluates to null when it does not matter. Thus, the rules are essentially the same. At least this is how I wrote my comparisons. If I do it wrong, then, holy god, I do it wrong, and I'm sure someone will tell me how to fix it!
Mike Hofer Feb 29 2018-12-12T00: 00Z
source share