Export (0) Print
Expand All

IPermission Interface

Defines methods implemented by permission types.

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

type IPermission =  
        interface ISecurityEncodable 

The IPermission type exposes the following members.

Public methodCopyCreates and returns an identical copy of the current permission.
Public methodDemandThrows a SecurityException at run time if the security requirement is not met.
Public methodFromXmlReconstructs a security object with a specified state from an XML encoding. (Inherited from ISecurityEncodable.)
Public methodIntersectCreates and returns a permission that is the intersection of the current permission and the specified permission.
Public methodIsSubsetOfDetermines whether the current permission is a subset of the specified permission.
Public methodToXmlCreates an XML encoding of the security object and its current state. (Inherited from ISecurityEncodable.)
Public methodUnionCreates a permission that is the union of the current permission and the specified permission.

Permissions in the common language runtime are objects that describe sets of operations that can be secured for specified resources. A permission object describes operations or access that is subject to security control; it does not represent access or a right to perform operations. Permissions are used by both application code and the .NET Framework security system in the following ways.

  • Code requests the permissions it needs in order to run.

  • The security system policy grants permissions to code in order for it to run.

  • Code demands that calling code has a permission.

  • Code overrides the security stack using assert/deny/permit-only.


If you write a new permission, you must implement this interface in your class.

Important noteImportant

A permission can be accessed by multiple threads. When implementing this interface, you must guarantee that the IsSubsetOf, Intersect, Union, and Copy method implementations are thread safe.

This example shows how to define a permission class for use with code access security. All of the necessary permission interfaces are implemented.

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

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft