public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj.GetType() != this.GetType()) { return(false); } CodeAccessPermission cap = (obj as CodeAccessPermission); return(IsSubsetOf(cap) && cap.IsSubsetOf(this)); }
internal bool CheckDeny(CodeAccessPermission denied) { if (denied == null) { return(true); } Type t = denied.GetType(); if (t != this.GetType()) { return(true); } IPermission inter = Intersect(denied); if (inter == null) { return(true); } // sadly that's not enough :( at this stage we must also check // if an empty (PermissionState.None) is a subset of the denied // (which is like a empty intersection looks like for flag based // permissions, e.g. AspNetHostingPermission). return(denied.IsSubsetOf(PermissionBuilder.Create(t))); }