Επεξεργασία

Κοινή χρήση μέσω


WebPermission.Intersect(IPermission) Method

Definition

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

Parameters

target
IPermission

The WebPermission to compare with the current instance.

Returns

A new WebPermission that represents the intersection of the current instance and the target parameter. If the intersection is empty, the method returns null.

Exceptions

target is not null or of type WebPermission

Examples

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

Remarks

Intersect returns a WebPermission that contains those permissions that are common in both target and the current instance.

This method overrides Intersect and is implemented to support the IPermission interface.

Applies to