This project has moved and is read-only. For the latest updates, please go here.


Jun 28, 2009 at 1:15 PM


Do we want the Complex class to implement IComparable?

Iridium has a comment "Since there is no canonical order among the complex numbers, Complex does not implement IComparable", but the complex class does implement IComparable.  dnA does not for the reason given in the Iridium comment. 

I think we shouldn't, but we should include the Iridium Comparer classes.



Jun 28, 2009 at 2:46 PM


Yes. The IComparer<T> interface seems to be better supported than the Comparison<T> delegate. Hence, providing comparer classes for common orderings would be nice.

Contra IComparable<T>:

  • No canonical ordering
  • Avoid confusion

Pro IComparable<T>:

  • Real-only complex numbers behave and can be treated like real (double) numbers.
  • IComparer<T> is not always supported (but it should be).
  • We could override the comparison operators. All in all somewhat easier to use in the default case.

I agree, providing only the comparer classes might be cleaner.


Marked as answer by cdrnet on 10/3/2013 at 5:34 PM