SourceGrid.ValueCellComparer.Compare C# (CSharp) Method

Compare() public method

public Compare ( System x, System y ) : Int32
x System
y System
return System.Int32
        public virtual System.Int32 Compare( System.Object x , System.Object y )
        {
            //Cell object
            if (x==null && y==null)
                return 0;
            if (x==null)
                return -1;
            if (y==null)
                return 1;

            if (x is IComparable)
                return ((IComparable)x).CompareTo(y);
            if (y is IComparable)
                return (-1* ((IComparable)y).CompareTo(x));

            //Cell.Value object
            object vx = ((Cells.ICell)x).Value;
            object vy = ((Cells.ICell)y).Value;
            if (vx==null && vy==null)
                return 0;
            if (vx==null)
                return -1;
            if (vy==null)
                return 1;

            if (vx is IComparable)
                return ((IComparable)vx).CompareTo(vy);
            if (vy is IComparable)
                return (-1* ((IComparable)vy).CompareTo(vx));

            throw new ArgumentException("Invalid cell object, no IComparable interface found");
        }
ValueCellComparer