Esempio n. 1
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            RmResource other = obj as RmResource;

            if (other == null)
            {
                return(false);
            }
            else
            {
                if (attributes.Count != other.attributes.Count)
                {
                    return(false);
                }
                foreach (KeyValuePair <RmAttributeName, RmAttributeValue> item in attributes)
                {
                    RmAttributeValue otherValue = null;
                    other.TryGetValue(item.Key, out otherValue);
                    if (otherValue == null)
                    {
                        return(false);
                    }
                    if (item.Value.Equals(otherValue) == false)
                    {
                        return(false);
                    }
                }
                return(true);
            }
        }