System.Security.SecurityCriticalAttribute Class

Specifies that code or an assembly performs security-critical operations.

See Also: SecurityCriticalAttribute Members


[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Delegate | System.AttributeTargets.All, AllowMultiple=false, Inherited=false)]
public sealed class SecurityCriticalAttribute : Attribute


Security-critical operations are actions that affect code access security, such as elevation of privilege through suppression of code access security checks by using the CodeAccessPermission.Assert method, calling unsafe managed code, and so forth. Either the System.Security.SecurityCriticalAttribute attribute or the System.Security.SecuritySafeCriticalAttribute attribute must be applied to code for the code to perform security-critical operations.


The System.Security.SecurityCriticalAttribute is equivalent to a link demand for full trust. A type or member marked with the System.Security.SecurityCriticalAttribute can be called only by fully trusted code; it does not have to demand specific permissions. It cannot be called by partially trusted code.

Applying the System.Security.SecurityCriticalAttribute at the assembly level identifies the assembly as a security-critical assembly. The entire assembly can be identified as critical by setting the scope parameter SecurityCriticalScope.Everything.


Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0