Adf.Base.Domain.ValueObjectPropertyParser.IsEqual C# (CSharp) Method

IsEqual() public method

Checks whether the two specified Objects are equal or not.
Not a valid value object.
public IsEqual ( object compare, object to ) : bool
compare object The Object to compare.
to object The Object to compare with.
return bool
        public bool IsEqual(object compare, object to)
        {
            var left = compare as IValueObject;
            var right = to as IValueObject;

            if (left == null) throw new ArgumentException("Argument is not a valid value object");
            if (right == null) throw new ArgumentException("Argument is not a valid value object");

            if (left.GetType() != right.GetType()) return false;

            if (left.IsEmpty && right.IsEmpty) return true;

            if (left.IsEmpty || right.IsEmpty) return false;

            return left.Equals(right);
        }