ReflectionPermission Class
Assembly: mscorlib (in mscorlib.dll)
[SerializableAttribute] [ComVisibleAttribute(true)] public ref class ReflectionPermission sealed : public CodeAccessPermission, IUnrestrictedPermission
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ public final class ReflectionPermission extends CodeAccessPermission implements IUnrestrictedPermission
SerializableAttribute ComVisibleAttribute(true) public final class ReflectionPermission extends CodeAccessPermission implements IUnrestrictedPermission
Not applicable.
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 System.Security.Permissions.ReflectionPermissionFlag.RestrictedMemberAccess 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.ReflectionEmit flag.
For more information, see the ReflectionPermissionFlag enumeration.
The following code example shows the behavior of the ReflectionPermission class methods.
Note: |
|---|
| The code example is intended to show the behavior of the methods, not to demonstrate their use. In general, the methods of permission classes are used by the security infrastructure; they are not typically used in applications. Generally, only the constructors are used in application code. The created instance validates or controls resource access by using inherited CodeAccessPermission methods such as Demand. |
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Caution: