ReflectionPermissionFlag 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
Code Access Security is not supported or honored by the runtime.
指定允许使用 System.Reflection 和 System.Reflection.Emit 命名空间。
此枚举支持其成员值的按位组合。
public enum class ReflectionPermissionFlag
[System.Flags]
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum ReflectionPermissionFlag
[System.Flags]
[System.Serializable]
public enum ReflectionPermissionFlag
[System.Flags]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum ReflectionPermissionFlag
[System.Flags]
public enum ReflectionPermissionFlag
[<System.Flags>]
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type ReflectionPermissionFlag =
[<System.Flags>]
[<System.Serializable>]
type ReflectionPermissionFlag =
[<System.Flags>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ReflectionPermissionFlag =
[<System.Flags>]
type ReflectionPermissionFlag =
Public Enum ReflectionPermissionFlag
- 继承
- 属性
字段
| 名称 | 值 | 说明 |
|---|---|---|
| NoFlags | 0 | 允许枚举类型和成员。 允许对可见类型和成员执行调用操作。 |
| TypeInformation | 1 | 此标志已过时。 枚举类型和成员以及检查其元数据不需要任何标志。 改用 NoFlags。 |
| MemberAccess | 2 | 无论授予集如何,都允许对所有成员执行调用操作。 如果未设置此标志,则仅允许对可见成员执行调用操作。 |
| ReflectionEmit | 4 | 允许发出调试符号。 从 .NET Framework 2.0 Service Pack 1 开始,此标志不再需要发出代码。 |
| AllFlags | 7 |
|
| RestrictedMemberAccess | 8 | 为部分受信任的代码提供了受限成员访问。 部分受信任的代码可以访问非公共类型和成员,但前提是部分受信任代码的授予集包含要访问的非公共类型和成员的程序集的授予集中的所有权限。 |
注解
Caution
代码访问安全性(CAS)已在 .NET Framework 和 .NET 的所有版本中弃用。 如果使用与 CAS 相关的 API,最新版本的 .NET 不会遵循 CAS 注释,并会生成错误。 开发人员应寻求完成安全任务的替代方法。
此枚举由 ReflectionPermission 类 ReflectionPermissionAttribute 使用。 ReflectionPermission如果未授予反射,则允许对所有类型和成员进行反射,但仅允许对可见类型和成员执行调用操作。 有关详细信息,请参阅 反射的安全注意事项。
Caution
由于ReflectionPermission可以提供对私有类成员的访问权限,因此我们建议你仅使用ReflectionPermission标志授予 Internet 代码,而不授予RestrictedMemberAccess任何其他标志。
Important
AllFlags 不包括标志 RestrictedMemberAccess 。 若要获取包含此枚举中的所有标志的掩码,必须结合使用 AllFlagsRestrictedMemberAccess。