Serializable NotInheritable Public Class Inherits

Serializable notinheritable public class inherits

This preview shows page 19 - 21 out of 129 pages.

<Serializable> NotInheritable Public Class ReflectionPermissionAttribute Inherits CodeAccessSecurityAttribute Remarks The scope of the declaration that is allowed depends on the 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. Example The following example of a declarative attribute shows the correct way to request ReflectionPermission for ReflectionEmit and states that you must have at least this permission to run your code. <Assembly: ReflectionPermissionAttribute(SecurityAction.RequestMinimum, _ ReflectionEmit := True)> 'In Visual Basic, you must specify that you are using the assembly scope when making a request. ReflectionPermission at link time. Demands are typically made in managed libraries (DLLs) to help protect methods or classes from potentially harmful code. <ReflectionPermissionAttribute(SecurityAction.Demand, _ Unrestricted := True)> Public Class SampleClass
Image of page 19