Edit

Share via


PermissionSet.Intersect(PermissionSet) Method

Definition

Creates and returns a permission set that is the intersection of the current PermissionSet and the specified PermissionSet.

public:
 System::Security::PermissionSet ^ Intersect(System::Security::PermissionSet ^ other);
public:
 virtual System::Security::PermissionSet ^ Intersect(System::Security::PermissionSet ^ other);
public System.Security.PermissionSet? Intersect (System.Security.PermissionSet? other);
public virtual System.Security.PermissionSet Intersect (System.Security.PermissionSet other);
public System.Security.PermissionSet Intersect (System.Security.PermissionSet other);
member this.Intersect : System.Security.PermissionSet -> System.Security.PermissionSet
abstract member Intersect : System.Security.PermissionSet -> System.Security.PermissionSet
override this.Intersect : System.Security.PermissionSet -> System.Security.PermissionSet
Public Function Intersect (other As PermissionSet) As PermissionSet
Public Overridable Function Intersect (other As PermissionSet) As PermissionSet

Parameters

other
PermissionSet

A permission set to intersect with the current PermissionSet.

Returns

A new permission set that represents the intersection of the current PermissionSet and the specified target. This object is null if the intersection is empty.

Examples

The following code example shows the use of the Intersect method. This code example is part of a larger example provided for the PermissionSet class.

// Display the intersection of two permission sets.
PermissionSet^ ps3 = ps2->Intersect( ps1 );
Console::WriteLine( "The intersection of the first permission set and the second permission set = {0}", ps3 );
// Display the intersection of two permission sets.
PermissionSet ps3 = ps2.Intersect(ps1);
Console.WriteLine("The intersection of the first permission set and "
    + "the second permission set = " + ps3.ToString());
' Display the intersection of two permission sets.
Dim ps3 As PermissionSet = ps2.Intersect(ps1)
Console.WriteLine("The intersection of the first permission set and " & "the second permission set = " & ps3.ToString())

Remarks

The intersection of two permission sets is a permission set that describes the set of operations they both describe in common. Specifically, it represents the minimum permissions such that any demand that passes both permission sets also passes their intersection.

For each type of permission that is present in both sets, the two instances of those permissions are intersected using the permission's Intersect method; the resulting permission is included in the resulting PermissionSet. Permission types that exist in only one of the two sets are excluded from the resulting set.

Applies to