This project is read-only.

Better way to compare

Sep 13, 2010 at 1:39 AM

As I was reading documentation of IComparer, it said in its remarks section that:

"The preferred implementation is to use the CompareTo method of one of the parameters."

At the other hand, when we are comparing two objects, at least one of them should implement IComparable (otherwise ArgumentException will be thrown); So there was no need of making a new object of type IComparer, plus using CompareTo() method of that IComparable object is preferred.


Sep 13, 2010 at 2:00 PM

You are right... unless that, I want to use "Dependency Injection Pattern" for comparer specification in next upcoming versions ! I am already aware of this... But, Thank you dude !