WebPermission.Intersect(IPermission) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回两个 WebPermission 实例的逻辑交集。
public:
override System::Security::IPermission ^ Intersect(System::Security::IPermission ^ target);
public override System.Security.IPermission Intersect (System.Security.IPermission target);
override this.Intersect : System.Security.IPermission -> System.Security.IPermission
Public Overrides Function Intersect (target As IPermission) As IPermission
参数
- target
- IPermission
与当前实例进行比较的 WebPermission。
返回
一个新的 WebPermission,表示当前实例和 target
参数的交集。 如果该交集为空,则该方法返回 null
。
例外
target
不为 null
,或者不是 WebPermission 类型
示例
以下示例演示如何使用两个现有WebPermission实例WebPermission的逻辑交集创建 实例。
// Create a third WebPermission instance via the logical intersection of the previous
// two WebPermission instances.
WebPermission^ myWebPermission3 = (WebPermission^)(myWebPermission1->Intersect( myWebPermission2 ));
Console::WriteLine( "\nAttributes and Values of the WebPermission instance after the Intersect are:\n" );
Console::WriteLine( myWebPermission3->ToXml() );
// Create a third WebPermission instance via the logical intersection of the previous
// two WebPermission instances.
WebPermission myWebPermission3 =(WebPermission) myWebPermission1.Intersect(myWebPermission2);
Console.WriteLine("\nAttributes and Values of the WebPermission instance after the Intersect are:\n");
Console.WriteLine(myWebPermission3.ToXml().ToString());
' Create a third WebPermission instance via the logical intersection of the previous
' two WebPermission instances.
Dim myWebPermission3 As WebPermission = CType(myWebPermission1.Intersect(myWebPermission2), WebPermission)
Console.WriteLine(ControlChars.Cr + "Attributes and Values of the WebPermission instance after the Intersect are:" + ControlChars.Cr)
Console.WriteLine(myWebPermission3.ToXml().ToString())
End Sub
注解
Intersect 返回一个 , WebPermission 其中包含在 和当前 实例中通用 target
的那些权限。
此方法重写 Intersect 并实现以支持 IPermission 接口。