System.Security.Permissions.StrongName2.IsSubsetOf C# (CSharp) Method

IsSubsetOf() public method

public IsSubsetOf ( StrongName2 target ) : bool
target StrongName2
return bool
        public bool IsSubsetOf(StrongName2 target)
        {
            // This StrongName2 is a subset of the target if it's public key blob is null no matter what
            if (this.m_publicKeyBlob == null)
                return true;

            // Subsets are always false if the public key blobs do not match
            if (!this.m_publicKeyBlob.Equals( target.m_publicKeyBlob ))
                return false;

            // We use null in strings to represent the "Anything" state.
            // Therefore, the logic to detect an individual subset is:
            //
            // 1. If the this string is null ("Anything" is a subset of any other).
            // 2. If the this string and target string are the same (equality is sufficient for a subset).
            //
            // The logic is reversed here to discover things that are not subsets.
            if (this.m_name != null)
            {
                if (target.m_name == null || !System.Security.Policy.StrongName.CompareNames( target.m_name, this.m_name ))
                    return false;
            }

            if ((Object) this.m_version != null)
            {
                if ((Object) target.m_version == null ||
                    target.m_version.CompareTo( this.m_version ) != 0)
                {
                    return false;
                }
            }

            return true;
        }
        

Usage Example

 public bool Equals(StrongName2 target)
 {
     if (!target.IsSubsetOf(this))
         return false;
     if (!this.IsSubsetOf(target))
         return false;
     return true;
 }
All Usage Examples Of System.Security.Permissions.StrongName2::IsSubsetOf