System.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Method

Adds declarative security to this method.

Syntax

public void AddDeclarativeSecurity (System.Security.Permissions.SecurityAction action, System.Security.PermissionSet pset)

Parameters

action
The security action to be taken (Demand, Assert, and so on).
pset
The set of permissions the action applies to.

Remarks

MethodBuilder.AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet) can be called several times, with each call specifying a security action (such as Demand, Assert, and Deny) and a set of permissions that the action applies to.

Note:

In the .NET Framework versions 1.0, 1.1, and 2.0, the declarative security attributes applied to a method by using the MethodBuilder.AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet) method are stored in the old XML metadata format. See Emitting Declarative Security Attributes.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0