WebPermission.Union(IPermission) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回 WebPermission 类的两个实例之间的逻辑并集。
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
与当前 WebPermission 进行合并的 WebPermission。
返回
表示当前实例和 target
参数的并集的 WebPermission。 如果其中任何一个 WebPermission
是 Unrestricted,则该方法返回一个为 Unrestricted 的 WebPermission。 如果目标为 null
,则该方法将返回当前 WebPermission 的副本。
例外
目标不为 null
,也不是 WebPermission 类型。
示例
以下示例采用两 WebPermission 个实例的逻辑联合来创建 的第 WebPermission三个实例。
// Create another WebPermission that is the Union of previous two WebPermission
// instances.
WebPermission^ myWebPermission3 = (WebPermission^)(myWebPermission1->Union( myWebPermission2 ));
Console::WriteLine( "\nAttributes and values of the WebPermission after the Union are : " );
// Display the attributes, values and children.
Console::WriteLine( myWebPermission3->ToXml() );
// Create another WebPermission that is the Union of previous two WebPermission
// instances.
WebPermission myWebPermission3 =(WebPermission) myWebPermission1.Union(myWebPermission2);
Console.WriteLine("\nAttributes and values of the WebPermission after the Union are : ");
// Display the attributes,values and children.
Console.WriteLine(myWebPermission3.ToXml().ToString());
' Create another WebPermission that is the Union of previous two WebPermission
' instances.
Dim myWebPermission3 As WebPermission = CType(myWebPermission1.Union(myWebPermission2), WebPermission)
Console.WriteLine(ControlChars.Cr + "Attributes and values of the WebPermission after the Union are : ")
' Display the attributes,values and children.
Console.WriteLine(myWebPermission3.ToXml().ToString())
End Sub
注解
Union 返回一个 , WebPermission 其中包含和当前实例中的所有 target
权限。