SecurityRuleSet SecurityRuleSet SecurityRuleSet SecurityRuleSet Enum

定义

标识公共语言运行时应该对程序集强制的一组安全规则。Identifies the set of security rules the common language runtime should enforce for an assembly.

public enum class SecurityRuleSet
public enum SecurityRuleSet
type SecurityRuleSet = 
Public Enum SecurityRuleSet
继承
SecurityRuleSetSecurityRuleSetSecurityRuleSetSecurityRuleSet

字段

Level1 Level1 Level1 Level1 1

指示运行时将强制 1 级(.NET Framework 2.0 版)透明规则。Indicates that the runtime will enforce level 1 (.NET Framework version 2.0) transparency rules.

Level2 Level2 Level2 Level2 2

指示运行时将强制 2 级透明规则。Indicates that the runtime will enforce level 2 transparency rules.

None None None None 0

不受支持。Unsupported. 使用此值会导致引发 FileLoadExceptionUsing this value results in a FileLoadException being thrown.

注解

此枚举表示公共语言运行时应该对程序集强制执行的安全规则集。This enumeration indicates which set of security rules the common language runtime should enforce for an assembly. 例如, 标记[SecurityRules(SecurityRuleSet.Level1)]为的程序集使用 .NET Framework 版本2.0 透明度规则, 在该规则中, 公共安全关键类型和成员在程序集外部被视为安全可靠关键。For example, an assembly that is marked with [SecurityRules(SecurityRuleSet.Level1)] uses the .NET Framework version 2.0 transparency rules, where public security-critical types and members are treated as security-safe-critical outside the assembly. 这需要安全关键类型和成员来执行完全信任的链接要求, 以便在外部调用方访问安全关键行为时强制执行该行为。This requires security-critical types and members to perform a link demand for full trust to enforce security-critical behavior when they are accessed by external callers. 通常情况下, 级别1规则仅用于兼容性, 如用于 .NET Framework 2.0 程序集。Typically, level 1 rules should be used only for compatibility, such as for .NET Framework 2.0 assemblies. 默认情况下, 为.NET Framework 4.NET Framework 4重新编译时, .NET Framework 2.0 程序集变为第2级程序集。By default, .NET Framework 2.0 assemblies become level 2 assemblies when they are recompiled for the .NET Framework 4.NET Framework 4. 若要将这些程序集编译为级别 1, 必须将它们显式标记为级别1。To compile these assemblies as level 1, you must mark them explicitly as level 1. 有关1级行为的详细信息, 请参阅安全透明代码, 级别 1For more information about level 1 behavior, see Security-Transparent Code, Level 1. 有关级别2行为的信息, 请参阅安全透明代码, 级别 2For information about level 2 behavior, see Security-Transparent Code, Level 2.

适用于

另请参阅