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 介面。