Exemplo n.º 1
0
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Line1">A Line&lt;T&gt;.</param>
        /// <param name="Line2">Another Line&lt;T&gt;.</param>
        /// <returns>true|false</returns>
        public static Boolean operator ==(Line2D <T> Line1, Line2D <T> Line2)
        {
            // If both are null, or both are same instance, return true.
            if (Object.ReferenceEquals(Line1, Line2))
            {
                return(true);
            }

            // If one is null, but not both, return false.
            if (((Object)Line1 == null) || ((Object)Line2 == null))
            {
                return(false);
            }

            return(Line1.Equals(Line2));
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            bool isSame     = false;
            var  newAddress = obj as Address;

            if (Line1.Equals(newAddress.Line1, StringComparison.OrdinalIgnoreCase) &&
                (Line2 ?? "").Equals((newAddress.Line2 ?? ""), StringComparison.OrdinalIgnoreCase) &&
                (Line3 ?? "").Equals((newAddress.Line3 ?? ""), StringComparison.OrdinalIgnoreCase) &&
                City.Equals(newAddress.City, StringComparison.OrdinalIgnoreCase) &&
                State.Equals(newAddress.State, StringComparison.OrdinalIgnoreCase) &&
                Country.Equals(newAddress.Country, StringComparison.OrdinalIgnoreCase) &&
                PostalCode.Equals(newAddress.PostalCode, StringComparison.OrdinalIgnoreCase))
            {
                isSame = true;
            }
            return(isSame);
        }