System.Security.Permissions.ReflectionPermission Class

Controls access to non-public types and members through the System.Reflection APIs. Controls some features of the System.Reflection.Emit APIs.

See Also: ReflectionPermission Members

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ReflectionPermission : System.Security.CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission

Remarks

Without System.Security.Permissions.ReflectionPermission, code can use reflection to access only the public members of objects. Code with System.Security.Permissions.ReflectionPermission and the appropriate System.Security.Permissions.ReflectionPermissionFlag flags can access the protected and private members of objects.

Note:

Because System.Security.Permissions.ReflectionPermission can provide access to non-public types and members, we recommend that you do not grant System.Security.Permissions.ReflectionPermission to Internet code, except with the ReflectionPermissionFlag.RestrictedMemberAccess flag. ReflectionPermissionFlag.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 System.Security.Permissions.ReflectionPermission with the ReflectionPermissionFlag.ReflectionEmit flag.

For more information, see the System.Security.Permissions.ReflectionPermissionFlag enumeration.

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.

Requirements

Namespace: System.Security.Permissions
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0