通过


ConfigurationSection.ShouldSerializePropertyInTargetVersion 方法

定义

指示在为 .NET Framework 的指定目标版本序列化配置对象层次结构时,是否应序列化指定的属性。

protected public:
 virtual bool ShouldSerializePropertyInTargetVersion(System::Configuration::ConfigurationProperty ^ property, System::String ^ propertyName, System::Runtime::Versioning::FrameworkName ^ targetFramework, System::Configuration::ConfigurationElement ^ parentConfigurationElement);
protected:
 virtual bool ShouldSerializePropertyInTargetVersion(System::Configuration::ConfigurationProperty ^ property, System::String ^ propertyName, System::Runtime::Versioning::FrameworkName ^ targetFramework, System::Configuration::ConfigurationElement ^ parentConfigurationElement);
protected internal virtual bool ShouldSerializePropertyInTargetVersion(System.Configuration.ConfigurationProperty property, string propertyName, System.Runtime.Versioning.FrameworkName targetFramework, System.Configuration.ConfigurationElement parentConfigurationElement);
protected virtual bool ShouldSerializePropertyInTargetVersion(System.Configuration.ConfigurationProperty property, string propertyName, System.Runtime.Versioning.FrameworkName targetFramework, System.Configuration.ConfigurationElement parentConfigurationElement);
abstract member ShouldSerializePropertyInTargetVersion : System.Configuration.ConfigurationProperty * string * System.Runtime.Versioning.FrameworkName * System.Configuration.ConfigurationElement -> bool
override this.ShouldSerializePropertyInTargetVersion : System.Configuration.ConfigurationProperty * string * System.Runtime.Versioning.FrameworkName * System.Configuration.ConfigurationElement -> bool
Protected Friend Overridable Function ShouldSerializePropertyInTargetVersion (property As ConfigurationProperty, propertyName As String, targetFramework As FrameworkName, parentConfigurationElement As ConfigurationElement) As Boolean
Protected Overridable Function ShouldSerializePropertyInTargetVersion (property As ConfigurationProperty, propertyName As String, targetFramework As FrameworkName, parentConfigurationElement As ConfigurationElement) As Boolean

参数

property
ConfigurationProperty

作为 ConfigurationProperty 序列化候选对象。

propertyName
String

对象在 XML 中发生时的名称 ConfigurationProperty

targetFramework
FrameworkName

.NET Framework 的目标版本。

parentConfigurationElement
ConfigurationElement

属性的父元素。

返回

true 如果应序列化, property 则为 .;否则为 false

注解

为 .NET Framework 4 及更高版本创建的每个配置节必须显式重写此方法并返回 true,但前提是指定的属性对 .NET Framework 的指定版本有效。 为早期版本的 .NET Framework 创建的现有配置节不必更改。

基类型包含此方法的默认实现,该方法始终返回 true。 如果实现配置节且不重写此方法,则默认情况下,配置节中包含的所有配置属性都将对所有框架版本进行序列化。

适用于