Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CodeAccessSecurityAttribute Class
Collapse the table of content
Expand the table of content

CodeAccessSecurityAttribute Class

Specifies the base attribute class for code access security.

For a list of all members of this type, see CodeAccessSecurityAttribute Members.

            Derived classes

[Visual Basic]
<AttributeUsage(AttributeTargets.Assembly Or AttributeTargets.Class _
   Or AttributeTargets.Struct Or AttributeTargets.Constructor Or _
MustInherit Public Class CodeAccessSecurityAttribute
   Inherits SecurityAttribute
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
   | AttributeTargets.Struct | AttributeTargets.Constructor |
public abstract class CodeAccessSecurityAttribute :
[AttributeUsage(AttributeTargets::Assembly |
   AttributeTargets::Class | AttributeTargets::Struct |
   AttributeTargets::Constructor | AttributeTargets::Method)]
public __gc __abstract class CodeAccessSecurityAttribute : public
   AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class |
   AttributeTargets.Struct | AttributeTargets.Constructor |
abstract class CodeAccessSecurityAttribute extends

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


This attribute class associates a SecurityAction, for example, Demand, with a custom security attribute.

The types that derive from CodeAccessSecurityAttribute are used to help restrict access to resources or securable operations.

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 only for declarative security. Use the corresponding permission class derived from CodeAccessPermission for imperative security.

Notes to Inheritors:  All permission attributes derived from this class must have only a single constructor that takes a SecurityAction as its only parameter.


Namespace: System.Security.Permissions

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

CodeAccessSecurityAttribute Members | System.Security.Permissions Namespace | Extending Metadata Using Attributes | CodeAccessPermission

© 2015 Microsoft