Exemple #1
0
 /// <summary>
 /// Compares this object to another <see cref="SmartInt32"/>
 /// for equality.
 /// </summary>
 public override bool Equals(object obj)
 {
     if (obj is SmartInt32)
     {
         SmartInt32 tmp = (SmartInt32)obj;
         if (this.IsEmpty && tmp.IsEmpty)
         {
             return(true);
         }
         else
         {
             return(this.Int.Equals(tmp.Int));
         }
     }
     else if (obj is Int32)
     {
         return(this.Int.Equals((Int32)obj));
     }
     else if (obj is string)
     {
         return(this.CompareTo(obj.ToString()) == 0);
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
 /// <summary>
 /// Compares one SmartInt32 to another.
 /// </summary>
 /// <remarks>
 /// This method works the same as the <see cref="int.CompareTo"/> method
 /// on the Int inttype, with the exception that it
 /// understands the concept of empty int values.
 /// </remarks>
 /// <param name="value">The int to which we are being compared.</param>
 /// <returns>A value indicating if the comparison int is less than, equal to or greater than this int.</returns>
 public int CompareTo(SmartInt32 value)
 {
     if (this.IsEmpty && value.IsEmpty)
     {
         return(0);
     }
     else
     {
         return(_int.CompareTo(value.Int));
     }
 }
 /// <summary>
 /// Compares one SmartInt32 to another.
 /// </summary>
 /// <remarks>
 /// This method works the same as the <see cref="int.CompareTo"/> method
 /// on the Int inttype, with the exception that it
 /// understands the concept of empty int values.
 /// </remarks>
 /// <param name="value">The int to which we are being compared.</param>
 /// <returns>A value indicating if the comparison int is less than, equal to or greater than this int.</returns>
 public int CompareTo(SmartInt32 value)
 {
     if (this.IsEmpty && value.IsEmpty)
         return 0;
     else
         return _int.CompareTo(value.Int);
 }