Share via


DataProtectionPermission.Union(IPermission) メソッド

定義

現在のアクセス許可と指定されたアクセス許可の和集合であるアクセス許可を作成します。

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

現在のアクセス許可と結合するアクセス許可。 これは、現在のアクセス許可と同じ型であることが必要です。

戻り値

現在のアクセス許可と指定されたアクセス許可の和集合を表す新しいアクセス許可。

例外

targetnull ではなく、現在のアクセス許可と同じ型のアクセス許可が指定されていません。

次のコード例は、 メソッドの使用方法を Union 示しています。 このコード例は、DataProtectionPermission クラスのために提供されている大規模な例の一部です。

注意

このコード例は、 メソッドの動作を示すことを目的としたもので、その使用方法を示すものではありません。 一般に、アクセス許可クラスのメソッドはセキュリティ インフラストラクチャによって使用されます。通常、アプリケーションでは使用されません。

Console::WriteLine( "Creating the union of the second and first "
"permissions." );
sp4 = dynamic_cast<DataProtectionPermission^>(sp2->Union( sp1 ));
Console::WriteLine( "Result of the union of the second permission "
"with the first: {0}", sp4->Flags );
Console.WriteLine("Creating the union of the second and first " +
    "permissions.");
sp4 = (DataProtectionPermission)sp2.Union(sp1);
Console.WriteLine("Result of the union of the second permission " +
    "with the first: " + sp4.Flags);
Console.WriteLine("Creating the union of the second and first " + "permissions.")
sp4 = CType(sp2.Union(sp1), DataProtectionPermission)
Console.WriteLine("Result of the union of the second permission with the first: " + sp4.Flags.ToString())

注釈

Union 呼び出しの結果は、現在のアクセス許可と指定されたアクセス許可の両方で表されるすべての操作を表すアクセス許可です。 いずれかのアクセス許可を渡す要求は、その共用体を渡します。

適用対象