Compartilhar via


WebPermission.Intersect(IPermission) Método

Definição

Retorna a interseção lógica de duas instâncias 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

Parâmetros

target
IPermission

O WebPermission de comparação com a instância atual.

Retornos

Um novo WebPermission que representa a interseção da instância atual e do parâmetro target. Se a interseção estiver vazia, o método retornará null.

Exceções

target não é null ou do tipo WebPermission

Exemplos

O exemplo a seguir mostra como criar uma instância do WebPermission usando a interseção lógica de duas instâncias existentes 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

Comentários

Intersect retorna um WebPermission que contém as permissões que são comuns em e target na instância atual.

Esse método substitui Intersect e é implementado para dar suporte à IPermission interface .

Aplica-se a