Mono Class Library: System.Security.Permissions Namespace

System.Security.Permissions.SecurityPermissionAttribute Class

Used to apply a security action and a set of security permissions to program code.

See Also: SecurityPermissionAttribute Members

System.Object
     System.Attribute
          System.Security.Permissions.SecurityAttribute
               System.Security.Permissions.CodeAccessSecurityAttribute
                    System.Security.Permissions.SecurityPermissionAttribute

[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.All, AllowMultiple=true, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SecurityPermissionAttribute : CodeAccessSecurityAttribute

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.

Remarks

Note:

The security permissions are defined in the System.Security.Permissions.SecurityPermissionFlag enumeration and are specified using the SecurityPermissionAttribute.Flags property.

The security information declared by a security attribute is stored in the metadata of the attribute target, and is accessed by the system at run-time. Security attributes are used for declarative security only. For imperative security, use the corresponding permission class, System.Security.Permissions.SecurityPermission.

The allowable System.Security.Permissions.SecurityPermissionAttribute targets are determined by the System.Security.Permissions.SecurityAction passed to the constructor.

Example

In the following example, the attribute target is an assembly. The attribute declares that the ability to assert permissions on behalf of callers is the minimum permission required for the assembly to execute.

[assembly:SecurityPermissionAttribute(SecurityAction.RequestMinimum, Assertion=true)]

Requirements

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