ReflectionPermission
Class
Definition
Controls access to non-public types and members through the System.Reflection APIs. Controls some features of the System.Reflection.Emit APIs.
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ReflectionPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
- Inheritance
- Attributes
- Implements
Inherited Members
System.Object
System.Security.CodeAccessPermission
Remarks
Without ReflectionPermission, code can use reflection to access only the public members of objects. Code with ReflectionPermission and the appropriate ReflectionPermissionFlag flags can access the protected and private members of objects.
Caution
Because ReflectionPermission can provide access to non-public types and members, we recommend that you do not grant ReflectionPermission to Internet code, except with the ReflectionPermissionFlag flag. RestrictedMemberAccess allows access to non-public members, with the restriction that the grant set of the non-public members must be equal to, or a subset of, the grant set of the code that accesses the non-public members.
Certain features of reflection emit, such as emitting debug symbols, require ReflectionPermission with the ReflectionPermissionFlag flag.
For more information, see the ReflectionPermissionFlag enumeration.
Constructors
| ReflectionPermission(PermissionState) |
Initializes a new instance of the ReflectionPermission class with either fully restricted or unrestricted permission as specified. |
| ReflectionPermission(ReflectionPermissionFlag) |
Initializes a new instance of the ReflectionPermission class with the specified access. |
Properties
| Flags |
Gets or sets the type of reflection allowed for the current permission. |
Methods
| Copy() |
Creates and returns an identical copy of the current permission. |
| FromXml(SecurityElement) |
Reconstructs a permission with a specified state from an XML encoding. |
| Intersect(IPermission) |
Creates and returns a permission that is the intersection of the current permission and the specified permission. |
| IsSubsetOf(IPermission) |
Determines whether the current permission is a subset of the specified permission. |
| IsUnrestricted() |
Returns a value indicating whether the current permission is unrestricted. |
| ToXml() |
Creates an XML encoding of the permission and its current state. |
| Union(IPermission) |
Creates a permission that is the union of the current permission and the specified permission. |