DataProtectionPermission.Intersect(IPermission) Método

Definição

Cria e retorna uma permissão que é a interseção de permissão atual e da permissão especificada.Creates and returns a permission that is the intersection of the current permission and the specified permission.

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

Parâmetros

target
IPermission

Uma permissão para ter interseção com a permissão atual.A permission to intersect with the current permission. Ele deve ser do mesmo tipo da permissão atual.It must be the same type as the current permission.

Retornos

IPermission

Uma nova permissão que representa a interseção da permissão atual e da permissão especificada.A new permission that represents the intersection of the current permission and the specified permission. Essa nova permissão é null se a interseção estiver vazia.This new permission is null if the intersection is empty.

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 Intersect método.The following code example shows the use of the Intersect 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.

Console::WriteLine( "Creating the intersection of the second and "
"first permissions." );
sp4 = dynamic_cast<DataProtectionPermission^>(sp2->Intersect( sp1 ));
Console::WriteLine( "The value of the Flags property is: {0}", sp4->Flags );

Console.WriteLine("Creating the intersection of the second and " +
    "first permissions.");
sp4 = (DataProtectionPermission)sp2.Intersect(sp1);
Console.WriteLine("The value of the Flags property is: " +
    sp4.Flags.ToString());
Console.WriteLine("Creating the intersection of the second and " + "first permissions.")
sp4 = CType(sp2.Intersect(sp1), DataProtectionPermission)
Console.WriteLine("The value of the Flags property is: " + sp4.Flags.ToString())

Comentários

A interseção de duas permissões é uma permissão que descreve o conjunto de operações que ambos descrevem em comum.The intersection of two permissions is a permission that describes the set of operations they both describe in common. Somente uma demanda que passa as duas permissões individuais passará a interseção.Only a demand that passes both individual permissions will pass the intersection.

Aplica-se a