Export (0) Print
Expand All

CodeAccessSecurityAttribute Class

Specifies the base attribute class for code access security.

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

System.Object
   System.Attribute
      System.Security.Permissions.SecurityAttribute
         System.Security.Permissions.CodeAccessSecurityAttribute
            Derived classes

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

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.

Remarks

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.

Requirements

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

Show:
© 2014 Microsoft