CompareTo() public method

public CompareTo ( object obj ) : int
obj object
return int
Beispiel #1
0
        public int Compare(object x, object y)
        {
            if (IsNull(x) && IsNull(y))
            {
                return(0);
            }
            else if (IsNull(x))
            {
                return(-1);
            }
            else if (IsNull(y))
            {
                return(1);
            }

            ClientVersion a = x as ClientVersion;
            ClientVersion b = y as ClientVersion;

            if (IsNull(a) || IsNull(b))
            {
                throw new ArgumentException();
            }

            return(a.CompareTo(b));
        }
Beispiel #2
0
 public static int Compare(ClientVersion a, ClientVersion b)
 {
     if (ClientVersion.IsNull(a) && ClientVersion.IsNull(b))
     {
         return(0);
     }
     if (ClientVersion.IsNull(a))
     {
         return(-1);
     }
     if (ClientVersion.IsNull(b))
     {
         return(1);
     }
     return(a.CompareTo(b));
 }
Beispiel #3
0
        public int Compare(object x, object y)
        {
            if (ClientVersion.IsNull(x) && ClientVersion.IsNull(y))
            {
                return(0);
            }
            if (ClientVersion.IsNull(x))
            {
                return(-1);
            }
            if (ClientVersion.IsNull(y))
            {
                return(1);
            }
            ClientVersion version1 = (x as ClientVersion);
            ClientVersion version2 = (y as ClientVersion);

            if (ClientVersion.IsNull(version1) || ClientVersion.IsNull(version2))
            {
                throw new ArgumentException();
            }
            return(version1.CompareTo(version2));
        }
		public static int Compare( ClientVersion a, ClientVersion b )
		{
			if ( IsNull( a ) && IsNull( b ) )
				return 0;
			else if ( IsNull( a ) )
				return -1;
			else if ( IsNull( b ) )
				return 1;

			return a.CompareTo( b );
		}