예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null || obj.GetType() != GetType())
            {
                return(false);
            }

            BaseValueObject      other       = (BaseValueObject)obj;
            IEnumerator <object> thisValues  = GetAtomicValues().GetEnumerator();
            IEnumerator <object> otherValues = other.GetAtomicValues().GetEnumerator();

            while (thisValues.MoveNext() && otherValues.MoveNext())
            {
                if (ReferenceEquals(thisValues.Current, null) ^
                    ReferenceEquals(otherValues.Current, null))
                {
                    return(false);
                }

                if (thisValues.Current != null &&
                    !thisValues.Current.Equals(otherValues.Current))
                {
                    return(false);
                }
            }
            return(!thisValues.MoveNext() && !otherValues.MoveNext());
        }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 protected static bool EqualOperator(BaseValueObject left, BaseValueObject right)
 {
     if (ReferenceEquals(left, null) ^ ReferenceEquals(right, null))
     {
         return(false);
     }
     return(ReferenceEquals(left, null) || left.Equals(right));
 }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 protected static bool NotEqualOperator(BaseValueObject left, BaseValueObject right)
 {
     return(!(EqualOperator(left, right)));
 }