ReflectionPermissionFlag Enumeration
.NET Framework 2.0
Specifies the permitted use of System.Reflection on members that are not visible.
Assembly: mscorlib (in mscorlib.dll)
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Namespace: System.Security.PermissionsAssembly: mscorlib (in mscorlib.dll)
'Declaration <SerializableAttribute> _ <ComVisibleAttribute(True)> _ <FlagsAttribute> _ Public Enumeration ReflectionPermissionFlag 'Usage Dim instance As ReflectionPermissionFlag
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ /** @attribute FlagsAttribute() */ public enum ReflectionPermissionFlag
SerializableAttribute ComVisibleAttribute(true) FlagsAttribute public enum ReflectionPermissionFlag
| Member name | Description | |
|---|---|---|
| AllFlags | TypeInformation, MemberAccess, and ReflectionEmit are set. | |
| MemberAccess | Invocation of operations on all type members is allowed. If this flag is not set, only invocation of operations on visible type members is allowed. | |
| NoFlags | No reflection is allowed on types that are not visible. | |
| ReflectionEmit | Use of System.Reflection.Emit is allowed. | |
| TypeInformation | Reflection is allowed on members of a type that are not visible. |
This enumeration is used by ReflectionPermission. If no ReflectionPermission is granted, reflection is allowed only on visible members.
Caution |
|---|
| Because ReflectionPermission can provide access to private class members and metadata, it is recommended that ReflectionPermission not be granted to Internet code. |
Imports System Imports System.Security Imports System.Security.Permissions Imports Microsoft.VisualBasic Public Class ReflectionGenerator Private myReflection As ReflectionPermissionFlag() = _ {ReflectionPermissionFlag.AllFlags, _ ReflectionPermissionFlag.MemberAccess, _ ReflectionPermissionFlag.NoFlags, _ ReflectionPermissionFlag.ReflectionEmit, _ ReflectionPermissionFlag.TypeInformation} Private reflectionIndex As Integer = 0 Public Sub New() ResetIndex() End Sub 'New Public Sub ResetIndex() reflectionIndex = 0 End Sub 'ResetIndex ' CreateReflection creates a ReflectionPermission object. Public Function CreateReflection(ByRef reflectionPerm As ReflectionPermission, ByRef reflection As ReflectionPermissionFlag) As Boolean If reflectionIndex >= myReflection.Length Then reflectionPerm = New ReflectionPermission(PermissionState.None) reflection = ReflectionPermissionFlag.NoFlags reflectionIndex &= 1 Return False End If reflection = myReflection(reflectionIndex) reflectionIndex = reflectionIndex + 1 Try reflectionPerm = New ReflectionPermission(reflection) Return True Catch e As Exception Console.WriteLine(("Cannot create ReflectionPermission: " & reflection & " " & e.ToString())) reflectionPerm = New ReflectionPermission(PermissionState.None) reflection = ReflectionPermissionFlag.NoFlags Return True End Try End Function 'CreateReflection End Class 'ReflectionGenerator ' End of ReflectionGenerator.
Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show:
Caution