Exemplo n.º 1
0
        /// <summary>
        /// Construct a suitable hash code.
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = 17;

                hashCode = hashCode * 92821 + base.GetHashCode( );

                if (UserName != null)
                {
                    hashCode = hashCode * 92821 + UserName.GetHashCode( );
                }

                if (PermissionAliases != null)
                {
                    hashCode = PermissionAliases.Aggregate(hashCode, (hc, alias) => hc * 92821 + alias.GetHashCode( ));
                }

                if (EntityIds != null)
                {
                    hashCode = EntityIds.Aggregate(hashCode, (hc, id) => hc * 92821 + id.GetHashCode( ));
                }

                return(hashCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Are the objects equal?
        /// </summary>
        /// <param name="obj">
        /// The object to compare.
        /// </param>
        /// <returns>
        /// True if they are equal, false otherwise.
        /// </returns>
        public override bool Equals(object obj)
        {
            PlatformSecurityException platformSecurityException;

            platformSecurityException = obj as PlatformSecurityException;
            return(platformSecurityException != null &&
                   (UserName == platformSecurityException.UserName) &&
                   PermissionAliases.SequenceEqual(platformSecurityException.PermissionAliases) &&
                   EntityIds.SequenceEqual(platformSecurityException.EntityIds));
        }