Exemple #1
0
        private static int Compare(object left, object right)
        {
            if (left == null)
            {
                left = "null";
            }
            if (right == null)
            {
                right = "null";
            }
            TypePair p = new TypePair(left.GetType(), right.GetType());

            if (comparers.ContainsKey(p))
            {
                return(comparers[p](left, right));
            }
            p.Swap();
            if (comparers.ContainsKey(p))
            {
                return(-comparers[p](right, left));
            }
            return(-string.Compare(right.ToString(), left.ToString()));
        }