Type.IsSecurityTransparent Type.IsSecurityTransparent Type.IsSecurityTransparent Type.IsSecurityTransparent Property


获取一个值,该值指示当前类型在当前信任级别上是否是透明的而无法执行关键操作。Gets a value that indicates whether the current type is transparent at the current trust level, and therefore cannot perform critical operations.

 virtual property bool IsSecurityTransparent { bool get(); };
public virtual bool IsSecurityTransparent { get; }
member this.IsSecurityTransparent : bool
Public Overridable ReadOnly Property IsSecurityTransparent As Boolean


如果该类型在当前信任级别上是安全透明的,则为 true;否则为 falsetrue if the type is security-transparent at the current trust level; otherwise, false.


如果此属性返回true,则IsSecurityCriticalIsSecuritySafeCritical属性返回falseIf this property returns true, the IsSecurityCritical and IsSecuritySafeCritical properties return false.

IsSecurityCriticalIsSecuritySafeCritical,和IsSecurityTransparent属性报告在其当前的信任级别,由公共语言运行时 (CLR) 类型的透明度级别。The IsSecurityCritical, IsSecuritySafeCritical, and IsSecurityTransparent properties report the transparency level of the type at its current trust level, as determined by the common language runtime (CLR). 使用这些属性比检查程序集及其类型的安全批注、检查当前的信任级别,以及尝试复制运行时的规则要简单得多。Using these properties is much simpler than examining the security annotations of an assembly and its types, checking the current trust level, and attempting to duplicate the runtime's rules.


对于部分信任程序集,此属性的值取决于当前的信任级别的程序集。For partial-trust assemblies, the value of this property depends on the current trust level of the assembly. 如果程序集加载到部分受信任的应用程序域 (例如,到沙盒应用程序域),运行时将忽略该程序集的安全批注。If the assembly is loaded into a partially trusted application domain (for example, into a sandboxed application domain), then the runtime ignores the security annotations of the assembly. 程序集及其所有类型被视为透明。The assembly and all its types are treated as transparent. 在运行时才会注意到部分信任程序集的安全批注时该程序集加载到完全受信任的应用程序域 (例如,为桌面应用程序的默认应用程序域)。The runtime pays attention to the security annotations of a partial-trust assembly only when that assembly is loaded into a fully trusted application domain (for example, into the default application domain of a desktop application). 与此相反,受信任的程序集 (即,具有强名称程序集安装在全局程序集缓存中) 是始终以而不考虑应用程序域的信任级别的完全信任方式加载的因此其当前的信任级别始终是完全受信任。By contrast, a trusted assembly (that is, a strong-named assembly that is installed in the global assembly cache) is always loaded with full trust regardless of the trust level of the application domain, so its current trust level is always fully trusted. 您可以使用来确定当前的信任级别的程序集和应用程序域Assembly.IsFullyTrustedAppDomain.IsFullyTrusted属性。You can determine the current trust levels of assemblies and application domains by using the Assembly.IsFullyTrusted and AppDomain.IsFullyTrusted properties.

有关反射和透明度的详细信息,请参阅反射的安全注意事项For more information about reflection and transparency, see Security Considerations for Reflection. 有关透明度的信息,请参阅安全更改For information about transparency, see Security Changes.