Novell.Directory.Ldap.LdapCompareAttrNames.Equals C# (CSharp) Method

Equals() public method

Determines if this comparator is equal to the comparator passed in. This will return true if the comparator is an instance of LdapCompareAttrNames and compares the same attributes names in the same order.
public Equals ( System comparator ) : bool
comparator System
return bool
        public override bool Equals(System.Object comparator)
        {
            if (!(comparator is LdapCompareAttrNames))
            {
                return false;
            }
            LdapCompareAttrNames comp = (LdapCompareAttrNames) comparator;

            // Test to see if the attribute to compare are the same length
            if ((comp.sortByNames.Length != this.sortByNames.Length) || (comp.sortAscending.Length != this.sortAscending.Length))
            {
                return false;
            }

            // Test to see if the attribute names and sorting orders are the same.
            for (int i = 0; i < this.sortByNames.Length; i++)
            {
                if (comp.sortAscending[i] != this.sortAscending[i])
                    return false;
                if (!comp.sortByNames[i].ToUpper().Equals(this.sortByNames[i].ToUpper()))
                    return false;
            }
            return true;
        }