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 比較。
傳回
WebPermission,表示目前執行個體和 target
參數間的聯集。 如果 WebPermission
是 Unrestricted,方法將傳回屬於 WebPermission 的 Unrestricted。 如果目標是 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
許可權。