System.Security.Permissions.ResourcePermissionBase.Intersect C# (CSharp) Method

Intersect() public method

public Intersect ( IPermission target ) : IPermission
target IPermission
return IPermission
        public override IPermission Intersect(IPermission target) {
            if (target == null)
                return null;

            if (target.GetType() != this.GetType())
                throw new ArgumentException(SR.GetString(SR.PermissionTypeMismatch), "target");
                       
            ResourcePermissionBase targetPermission = (ResourcePermissionBase)target;            
            if (this.IsUnrestricted())
                return targetPermission.Copy();

            if (targetPermission.IsUnrestricted())
                return this.Copy();

            ResourcePermissionBase newPermission = null;
            Hashtable newPermissionRootTable = (Hashtable)IntersectContents(this.rootTable, targetPermission.rootTable);
            if (newPermissionRootTable != null) {
                newPermission = CreateInstance();
                newPermission.rootTable = newPermissionRootTable;
            }
            return newPermission;
        }