ConfigurationSection.ShouldSerializeSectionInTargetVersion(FrameworkName) ConfigurationSection.ShouldSerializeSectionInTargetVersion(FrameworkName) ConfigurationSection.ShouldSerializeSectionInTargetVersion(FrameworkName) ConfigurationSection.ShouldSerializeSectionInTargetVersion(FrameworkName) Method

定义

指示在为指定目标版本的 .NET Framework.NET Framework 序列化配置对象层次结构时,是否应序列化当前的 ConfigurationSection 实例。Indicates whether the current ConfigurationSection instance should be serialized when the configuration object hierarchy is serialized for the specified target version of the .NET Framework.NET Framework.

protected public:
 virtual bool ShouldSerializeSectionInTargetVersion(System::Runtime::Versioning::FrameworkName ^ targetFramework);
protected internal virtual bool ShouldSerializeSectionInTargetVersion (System.Runtime.Versioning.FrameworkName targetFramework);
abstract member ShouldSerializeSectionInTargetVersion : System.Runtime.Versioning.FrameworkName -> bool
override this.ShouldSerializeSectionInTargetVersion : System.Runtime.Versioning.FrameworkName -> bool
Protected Friend Overridable Function ShouldSerializeSectionInTargetVersion (targetFramework As FrameworkName) As Boolean

参数

targetFramework
FrameworkName FrameworkName FrameworkName FrameworkName

.NET Framework.NET Framework 的目标版本。The target version of the .NET Framework.NET Framework.

返回

如果应序列化当前节,则为 true;否则为 falsetrue if the current section should be serialized; otherwise, false.

注解

.NET Framework 4.NET Framework 4及更高版本创建的每个配置节必须显式重写此方法并true返回,但前提是配置节对于的指定版本.NET Framework.NET Framework有效。Each configuration section that is created for the .NET Framework 4.NET Framework 4 and later versions must explicitly override this method and return true, but only if the configuration section is valid for the specified version of the .NET Framework.NET Framework. 为的早期版本.NET Framework.NET Framework创建的现有配置节不必更改。Existing configuration sections that were created for earlier versions of the .NET Framework.NET Framework do not have to be changed.

基类型包含此方法的默认实现,该实现始终返回trueThe base type contains a default implementation of this method that always returns true. 如果实现配置节并且不重写此方法,则默认情况下,将为所有框架版本序列化配置节。If you implement a configuration section and you do not override this method, by default the configuration section will be serialized for all framework versions.

适用于

另请参阅