SiteIdentityPermission.Union(IPermission) 方法

定义

创建一个权限,该权限是当前权限与指定权限的并集。Creates a permission that is the union of the current permission and the specified permission.

public:
 override System::Security::IPermission ^ Union(System::Security::IPermission ^ target);
public override System.Security.IPermission Union (System.Security.IPermission target);
override this.Union : System.Security.IPermission -> System.Security.IPermission
Public Overrides Function Union (target As IPermission) As IPermission

参数

target
IPermission

与当前权限合并的权限。A permission to combine with the current permission. 它必须与当前权限属于同一类型。It must be of the same type as the current permission.

返回

IPermission

表示同时兼具当前权限和指定权限的新权限。A new permission that represents the union of the current permission and the specified permission.

例外

target 参数不为 null,并且与当前权限不属于同一类型。The target parameter is not null and is not of the same type as the current permission.

- 或 --or- 权限不相等且其中一个不是另一个的子集。The permissions are not equal and one is not a subset of the other.

注解

调用的结果 Union 是一个权限,它表示当前权限和指定权限所表示的所有站点。The result of a call to Union is a permission that represents all the sites represented by both the current permission and the specified permission. 任何传递任意权限的需求都将传递其联合。Any demand that passes either permission passes their union. 例如,表示对的权限以及表示访问权限的权限的联合 www.fourthcoffee.com 是表示对的 *.fourthcoffee.com 访问权限的权限 *.fourthcoffee.comFor example, the union of a permission that represents access to www.fourthcoffee.com and one that represents access to *.fourthcoffee.com is a permission that represents access to *.fourthcoffee.com.

权限的并集 null 是不是的权限 nullThe union of a permission and null is the permission that is not null. 权限和权限子集的联合是包含子集的权限。The union of a permission and a subset of that permission is the permission that contains the subset. 任何其他组合会导致 ArgumentException 引发。Any other combination results in an ArgumentException being thrown. 例如,站点标识 www.fourthcoffee.com 和站点标识的联合将 www.tailspintoys.com 导致异常,因为两者都不是另一个的子集。For example, the union of the site identity www.fourthcoffee.com and the site identity www.tailspintoys.com results in an exception because neither is a subset of the other.

适用于