예제 #1
0
        public override bool Equals(object obj)
        {
            RangeBase <T> other = obj as RangeBase <T>;

            if (other != null)
            {
                return(this.Equals(other));
            }

            // ReSharper disable once BaseObjectEqualsIsObjectEquals
            return(base.Equals(obj));
        }
예제 #2
0
        public bool Equals(RangeBase <T> other)
        {
            if (other == null)
            {
                return(false);
            }

            if (this.HasStart != other.HasStart || this.HasEnd != other.HasEnd)
            {
                return(false);
            }

            object startObj = this.Start;

            if (startObj == null)
            {
                object otherStart = other.Start;
                if (otherStart != null)
                {
                    return(false);
                }
            }
            else
            {
                if (!this.Start.Equals(other.Start))
                {
                    return(false);
                }
            }

            object endObj = this.End;

            if (endObj == null)
            {
                object otherEnd = other.End;
                if (otherEnd != null)
                {
                    return(false);
                }
            }
            else
            {
                if (!this.End.Equals(other.End))
                {
                    return(false);
                }
            }

            return(true);
        }