System.Security.Permissions.StrongNameIdentityPermission.SNIP.IsSubsetOf C# (CSharp) Method

IsSubsetOf() private method

private IsSubsetOf ( SNIP target ) : bool
target SNIP
return bool
			internal bool IsSubsetOf (SNIP target)
			{
				if ((PublicKey != null) && PublicKey.Equals (target.PublicKey))
					return true;

				if (!IsNameSubsetOf (target.Name))
					return false;
				if ((AssemblyVersion != null) && !AssemblyVersion.Equals (target.AssemblyVersion))
					return false;
				// in case PermissionState.None was used in the constructor
				if (PublicKey == null)
					return (target.PublicKey == null);
				return false;
			}
		}

Usage Example

        /// <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);
        }