c# - list.Sort ArgumentException error: IComparer doesn't not return 0(null) -


I have the following problem and I can not know where it comes from. I appreciate a lot of help.

code:

  list & lt; Point & gt; Lst = new list & lt; Point & gt; (); Lst.Add (new point (0, -2)); Lst.Add (new point (-1, -2)); Lst.Sort (Rep (Point x, Point y) {if (xx == 0) Return -1; And if (yX == 0) Returns 1; Other {Double Rightwall 1 = xY * 1.0 / -xX; Double Retal 2 = YY * 1.0 / -x; Int Rated = - Math Sign (Rate Val1 - retVal2); Return Ritvail;}});   

If executed, I get an argument exclamation that is saying that iCompair 0 does not return 0 (empty). However, it really can not return anything else, but -1, 0 and 1, or?

Thank you very much for your help!

Ah, I am using Net 3.5 on BTW. In fact the error message says: was not ICMPearer (or depends on ICOmable methods)

Array back zero when array. CompareTo (X). X: '' Type of X: 'Point' iComfortire: 'System. Array + Future Compairer 1 [System. Drawing Point] '.

Objects are the same if you have to return 0:

  lst.Sort (rep (point x, point y) {if (xX == yX and xY == yY) {// You are missing this return 0;} If (xx == 0) returns -1; and if (yX == 0) returns 1; and (double ratewall 1 = xy * 1.0 / -xX; double click 2 = yY * 1.0 / -x; int rate = - value sign (rate val1 - retVal2); return return;}});    

Comments