WebPermission.Intersect(IPermission) 方法
定义
返回两个 WebPermission 实例的逻辑交集。Returns the logical intersection of two WebPermission instances.
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。The WebPermission to compare with the current instance.
返回
一个新的 WebPermission,表示当前实例和 target 参数的交集。A new WebPermission that represents the intersection of the current instance and the target parameter. 如果该交集为空,则该方法返回 null。If the intersection is empty, the method returns null.
例外
target 不为 null,或者不是 WebPermission 类型target is not null or of type WebPermission
示例
下面的示例演示如何 WebPermission 使用两个现有实例的逻辑交集创建的实例 WebPermission 。The following example shows how to create an instance of WebPermission using the logical intersection of two existing WebPermission instances.
// 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 returns a WebPermission that contains those permissions that are common in both target and the current instance.
此方法将重写 Intersect 并实现以支持 IPermission 接口。This method overrides Intersect and is implemented to support the IPermission interface.