Exemple #1
0
 public override bool Equals(object obj)
 {
     if (obj == null)
     {
         return(false);
     }
     else if (object.ReferenceEquals(this, obj))
     {
         return(true);
     }
     else if (obj is RadixNumeral)
     {
         RadixNumeral radNum = (RadixNumeral)obj;
         return(
             this.Base == radNum.Base
             &&
             this.Value == radNum.Base
             &&
             RadixNumeral.GetHashString(this) == RadixNumeral.GetHashString(radNum)
             );
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         BigInteger hash = this.Value ^ this.Base ^ RadixNumeral.GetHashString(this).GetHashCode();
         if (hash > int.MaxValue)
         {
             hash = hash % int.MaxValue;
         }
         return((int)hash);
     }
 }