WebPermission.Intersect(IPermission) Método

Definição

Retorna a interseção lógica de duas instâncias WebPermission.Returns the logical intersection of two WebPermission instances.

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.The WebPermission to compare with the current instance.

Retornos

Um novo WebPermission que representa a interseção da instância atual e do parâmetro target.A new WebPermission that represents the intersection of the current instance and the target parameter. Se a interseção estiver vazia, o método retornará null.If the intersection is empty, the method returns null.

Exceções

target não é null ou do tipo WebPermissiontarget is not null or of type 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 do WebPermission.The following example shows how to create an instance of WebPermission using the logical intersection of two existing WebPermission instances.

// 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 uma WebPermission que contém as permissões que são comuns em target e na instância atual.Intersect returns a WebPermission that contains those permissions that are common in both target and the current instance.

Esse método substitui Intersect e é implementado para dar suporte à interface IPermission.This method overrides Intersect and is implemented to support the IPermission interface.

Aplica-se a