System.Security.Permissions.PublisherIdentityPermission.Copy C# (CSharp) Method

Copy() public method

public Copy ( ) : IPermission
return IPermission
        public override IPermission Copy()
        {
            return this;
        }

Same methods

PublisherIdentityPermission::Copy ( ) : System.Security.IPermission

Usage Example

        /// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
        /// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
        /// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is <see langword="null" /> if the intersection is empty.</returns>
        /// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not <see langword="null" /> and is not of the same type as the current permission. </exception>
        // Token: 0x060026D9 RID: 9945 RVA: 0x0008CEF8 File Offset: 0x0008B0F8
        public override IPermission Intersect(IPermission target)
        {
            if (target == null)
            {
                return(null);
            }
            PublisherIdentityPermission publisherIdentityPermission = target as PublisherIdentityPermission;

            if (publisherIdentityPermission == null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", new object[]
                {
                    base.GetType().FullName
                }));
            }
            if (this.m_unrestricted && publisherIdentityPermission.m_unrestricted)
            {
                return(new PublisherIdentityPermission(PermissionState.None)
                {
                    m_unrestricted = true
                });
            }
            if (this.m_unrestricted)
            {
                return(publisherIdentityPermission.Copy());
            }
            if (publisherIdentityPermission.m_unrestricted)
            {
                return(this.Copy());
            }
            if (this.m_certs == null || publisherIdentityPermission.m_certs == null || this.m_certs.Length == 0 || publisherIdentityPermission.m_certs.Length == 0)
            {
                return(null);
            }
            ArrayList arrayList = new ArrayList();

            foreach (X509Certificate x509Certificate in this.m_certs)
            {
                foreach (X509Certificate other in publisherIdentityPermission.m_certs)
                {
                    if (x509Certificate.Equals(other))
                    {
                        arrayList.Add(new X509Certificate(x509Certificate));
                    }
                }
            }
            if (arrayList.Count == 0)
            {
                return(null);
            }
            return(new PublisherIdentityPermission(PermissionState.None)
            {
                m_certs = (X509Certificate[])arrayList.ToArray(typeof(X509Certificate))
            });
        }
All Usage Examples Of System.Security.Permissions.PublisherIdentityPermission::Copy