System.Security.PermissionSet.AddPermission Method

Adds a specified permission to the System.Security.PermissionSet.

Syntax

public IPermission AddPermission (IPermission perm)

Parameters

perm
The permission to add.

Returns

The union of the permission added and any permission of the same type that already exists in the System.Security.PermissionSet.

Exceptions

TypeReason
ArgumentException perm is not a System.Security.IPermission object.

Remarks

If a permission of the same type as the added permission already exists in the System.Security.PermissionSet, the new permission is the union of the existing permission object and the specified permission object. For example, if a permission that implements System.Security.Permissions.IUnrestrictedPermission is added to an System.Security.Permissions.PermissionState.Unrestricted System.Security.PermissionSet, the resulting union is the original Unrestricted System.Security.PermissionSet.

Requirements

Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0