Allows security actions for System.Security.Permissions.ReflectionPermission to be applied to code using declarative security.
See Also: ReflectionPermissionAttribute Members
The scope of the declaration that is allowed depends on the System.Security.Permissions.SecurityAction that is used.
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. For imperative security, use the corresponding permission class.
The following example shows a declarative request for access to non-public members of loaded assemblies. The SecurityAction.RequestMinimum security action indicates that this is the minimum permission required for the target assembly to be able to execute.
[assembly:ReflectionPermissionAttribute(SecurityAction.RequestMinimum, MemberAccess=true)]
The following example shows how to demand that the calling code has unrestricted access to non-public types. Demands are typically made to protect methods or classes from malicious code.
[ReflectionPermissionAttribute(SecurityAction.Demand, Unrestricted=true)]