Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SetPermission Method

PermissionSet.SetPermission Method

Sets a permission to the PermissionSet, replacing any existing permission of the same type.

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

member SetPermission : 
        perm:IPermission -> IPermission

Parameters

perm
Type: System.Security.IPermission

The permission to set.

Return Value

Type: System.Security.IPermission
The set permission.

ExceptionCondition
InvalidOperationException

The method is called from a ReadOnlyPermissionSet.

This method removes any existing permission object of the same type from the PermissionSet and replaces it with the perm parameter. If a permission that implements IUnrestrictedPermission is set on a PermissionSet that is Unrestricted, the resulting PermissionSet is no longer Unrestricted.

Notes to Inheritors

When you inherit from PermissionSet, you can change the behavior of the SetPermission method by overriding the SetPermissionImpl method.

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

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft