DataProtectionPermission.Intersect Method (IPermission)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Security.Permissions
Assembly:  System.Security (in System.Security.dll)

public override IPermission Intersect(
	IPermission target
)

Parameters

target
Type: System.Security.IPermission

A permission to intersect with the current permission. It must be the same type as the current permission.

Return Value

Type: System.Security.IPermission

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

Exception Condition
ArgumentException

target is not null and does not specify a permission of the same type as the current permission.

The intersection of two permissions is a permission that describes the set of operations they both describe in common. Only a demand that passes both individual permissions will pass the intersection.

The following code example shows the use of the Intersect method. 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 = (DataProtectionPermission)sp2.Intersect(sp1);
Console.WriteLine("The value of the Flags property is: " +
    sp4.Flags.ToString());

.NET Framework
Available since 2.0
Return to top
Show: