PermissionSet.RemovePermission Method (Type)
Removes a permission of a certain type from the set.
Assembly: mscorlib (in mscorlib.dll)
You cannot remove permissions from an unrestricted permission set. The permission set remains unrestricted after you attempt to remove the permission, and an exception is not thrown.
The following C# code attempts to remove the FileIOPermission from the FullTrust permission set, but the permission is not removed.
PolicyLevel myPol = PolicyLevel.CreateAppDomainLevel(); PermissionSet myPermSet = myPol.GetNamedPermissionSet("FullTrust"); myPermSet.RemovePermission(typeof(FileIOPermission));
Notes to Inheritors:
Available since 1.1