T
Tony Johansson
Here is a working code but I just wonder if it's possible to write the code
so the amount of code is shorter ?
int IComparer<PointF>.Compare(PointF point1, PointF point2)
{
if (currentMode == Mode.X)
{
if (point1.X > point2.X)
return 1;
else if (point1.X < point2.X)
return -1;
else
return 0;
}
else
{
if (point1.Y > point2.Y)
return 1;
else if (point1.Y < point2.Y)
return -1;
else
return 0;
}
}
//Tony
so the amount of code is shorter ?
int IComparer<PointF>.Compare(PointF point1, PointF point2)
{
if (currentMode == Mode.X)
{
if (point1.X > point2.X)
return 1;
else if (point1.X < point2.X)
return -1;
else
return 0;
}
else
{
if (point1.Y > point2.Y)
return 1;
else if (point1.Y < point2.Y)
return -1;
else
return 0;
}
}
//Tony