public bool Equal(SecurityElement other) { if (other == null) { return(false); } if (this == other) { return(true); } if (this.text != other.text) { return(false); } if (this.tag != other.tag) { return(false); } if (this.attributes == null && other.attributes != null && other.attributes.Count != 0) { return(false); } if (other.attributes == null && this.attributes != null && this.attributes.Count != 0) { return(false); } if (this.attributes != null && other.attributes != null) { if (this.attributes.Count != other.attributes.Count) { return(false); } foreach (SecurityAttribute sa1 in attributes) { SecurityAttribute sa2 = other.GetAttribute(sa1.Name); if ((sa2 == null) || (sa1.Value != sa2.Value)) { return(false); } } } if (this.children == null && other.children != null && other.children.Count != 0) { return(false); } if (other.children == null && this.children != null && this.children.Count != 0) { return(false); } if (this.children != null && other.children != null) { if (this.children.Count != other.children.Count) { return(false); } for (int i = 0; i < this.children.Count; i++) { if (!((SecurityElement)this.children[i]).Equal((SecurityElement)other.children[i])) { return(false); } } } return(true); }