DataProtectionPermission.Union(IPermission) Método
Definição
Cria uma permissão que é a união entre a permissão atual e a permissão especificada.Creates a permission that is the union of the current permission and the specified permission.
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
Parâmetros
- target
- IPermission
Uma permissão a ser combinada com a permissão atual.A permission to combine with the current permission. Ele deve ser do mesmo tipo da permissão atual.It must be of the same type as the current permission.
Retornos
Uma nova permissão que representa a união da permissão atual e da permissão especificada.A new permission that represents the union of the current permission and the specified permission.
Exceções
target não é null e não especifica uma permissão do mesmo tipo da permissão atual.target is not null and does not specify a permission of the same type as the current permission.
Exemplos
O exemplo de código a seguir mostra o uso do Union método.The following code example shows the use of the Union method. Este exemplo de código faz parte de um exemplo maior fornecido para a DataProtectionPermission classe.This code example is part of a larger example provided for the DataProtectionPermission class.
Observação
O exemplo de código destina-se a mostrar o comportamento do método, não para demonstrar seu uso.The code example is intended to show the behavior of the method, not to demonstrate its use. Em geral, os métodos de classes de permissão são usados pela infraestrutura de segurança; Normalmente, eles não são usados em aplicativos.In general, the methods of permission classes are used by the security infrastructure; they are not typically used in applications.
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())
Comentários
O resultado de uma chamada para Union é uma permissão que representa todas as operações representadas pela permissão atual e a permissão especificada.The result of a call to Union is a permission that represents all operations represented by both the current permission and the specified permission. Qualquer demanda que passe a permissão passa sua União.Any demand that passes either permission passes their union.