System.Net.WebPermission.Copy C# (CSharp) Method

Copy() public method

public Copy ( ) : IPermission
return IPermission
        public override IPermission Copy() {
            if (m_noRestriction)
            {
                return new WebPermission(true);
            }

            WebPermission wp = new WebPermission((m_UnrestrictedConnect ? NetworkAccess.Connect : (NetworkAccess) 0) |
                (m_UnrestrictedAccept ? NetworkAccess.Accept : (NetworkAccess)0));
            wp.m_acceptList = (ArrayList)m_acceptList.Clone();
            wp.m_connectList = (ArrayList)m_connectList.Clone();
            return wp;
        }

Usage Example

示例#1
0
        public override IPermission Union(IPermission target)
        {
            // LAMESPEC: according to spec we should throw an
            // exception when target is null. We'll follow the
            // behaviour of MS.Net instead of the spec, also
            // because it matches the Intersect behaviour.

            if (target == null)
            {
                return(null);
            }
            // throw new ArgumentNullException ("target");

            WebPermission perm = target as WebPermission;

            if (perm == null)
            {
                throw new ArgumentException("Argument not of type WebPermission");
            }
            if (this.m_noRestriction || perm.m_noRestriction)
            {
                return(new WebPermission(PermissionState.Unrestricted));
            }

            WebPermission copy = (WebPermission)perm.Copy();

            copy.m_acceptList.InsertRange(copy.m_acceptList.Count, this.m_acceptList);
            copy.m_connectList.InsertRange(copy.m_connectList.Count, this.m_connectList);

            return(copy);
        }
All Usage Examples Of System.Net.WebPermission::Copy