// IComparable // Compares this object to another object, returning an integer that // indicates the relationship. // Returns a value less than zero if this < object, zero if this = object, // or a value greater than zero if this > object. // null is considered to be less than any instance. // If object is not of same type, this method throws an ArgumentException. /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public int CompareTo(Object value) { if (value is SqlGuid) { SqlGuid i = (SqlGuid)value; return(CompareTo(i)); } throw ADP.WrongType(value.GetType(), typeof(SqlGuid)); }
// Comparison operators private static EComparison Compare(SqlGuid x, SqlGuid y) { //Swap to the correct order to be compared for (int i = 0; i < s_sizeOfGuid; i++) { byte b1, b2; b1 = x._value[s_rgiGuidOrder[i]]; b2 = y._value[s_rgiGuidOrder[i]]; if (b1 != b2) { return((b1 < b2) ? EComparison.LT : EComparison.GT); } } return(EComparison.EQ); }
// Compares this instance with a specified object /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public override bool Equals(Object value) { if (!(value is SqlGuid)) { return(false); } SqlGuid i = (SqlGuid)value; if (i.IsNull || IsNull) { return(i.IsNull && IsNull); } else { return((this == i).Value); } }
public int CompareTo(SqlGuid value) { // If both Null, consider them equal. // Otherwise, Null is less than anything. if (IsNull) { return(value.IsNull ? 0 : -1); } else if (value.IsNull) { return(1); } if (this < value) { return(-1); } if (this > value) { return(1); } return(0); }
// Alternative method for operator >= public static SqlBoolean GreaterThanOrEqual(SqlGuid x, SqlGuid y) { return(x >= y); }
// Alternative method for operator <= public static SqlBoolean LessThanOrEqual(SqlGuid x, SqlGuid y) { return(x <= y); }
// Alternative method for operator > public static SqlBoolean GreaterThan(SqlGuid x, SqlGuid y) { return(x > y); }
// Alternative method for operator < public static SqlBoolean LessThan(SqlGuid x, SqlGuid y) { return(x < y); }
// Alternative method for operator != public static SqlBoolean NotEquals(SqlGuid x, SqlGuid y) { return(x != y); }
//-------------------------------------------------- // Alternative methods for overloaded operators //-------------------------------------------------- // Alternative method for operator == public static SqlBoolean Equals(SqlGuid x, SqlGuid y) { return(x == y); }