public override bool IsSubsetOf(IPermission target) { StrongNameIdentityPermission snip = Cast(target); if (snip == null) { return(IsEmpty()); } if (IsEmpty()) { return(true); } if (IsUnrestricted()) { return(snip.IsUnrestricted()); } else if (snip.IsUnrestricted()) { return(true); } foreach (SNIP e in _list) { foreach (SNIP t in snip._list) { if (!e.IsSubsetOf(t)) { return(false); } } } return(true); }
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary> /// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns> /// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param> /// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception> public override bool IsSubsetOf(IPermission target) { StrongNameIdentityPermission strongNameIdentityPermission = this.Cast(target); if (strongNameIdentityPermission == null) { return(this.IsEmpty()); } if (this.IsEmpty()) { return(true); } if (this.IsUnrestricted()) { return(strongNameIdentityPermission.IsUnrestricted()); } if (strongNameIdentityPermission.IsUnrestricted()) { return(true); } foreach (object obj in this._list) { StrongNameIdentityPermission.SNIP snip = (StrongNameIdentityPermission.SNIP)obj; foreach (object obj2 in strongNameIdentityPermission._list) { StrongNameIdentityPermission.SNIP target2 = (StrongNameIdentityPermission.SNIP)obj2; if (!snip.IsSubsetOf(target2)) { return(false); } } } return(true); }