ConfigurationSection.ShouldSerializePropertyInTargetVersion 方法

定义

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

protected:
 virtual bool ShouldSerializePropertyInTargetVersion(System::Configuration::ConfigurationProperty ^ property, System::String ^ propertyName, System::Runtime::Versioning::FrameworkName ^ targetFramework, System::Configuration::ConfigurationElement ^ parentConfigurationElement);
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, 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);
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 Overridable Function ShouldSerializePropertyInTargetVersion (property As ConfigurationProperty, propertyName As String, targetFramework As FrameworkName, parentConfigurationElement As ConfigurationElement) As Boolean
Protected Friend Overridable Function ShouldSerializePropertyInTargetVersion (property As ConfigurationProperty, propertyName As String, targetFramework As FrameworkName, parentConfigurationElement As ConfigurationElement) As Boolean

参数

property
ConfigurationProperty

作为候选序列化对象的 ConfigurationProperty 对象。

propertyName
String

ConfigurationProperty 对象出现在 XML 中的名称。

targetFramework
FrameworkName

.NET Framework的目标版本。

parentConfigurationElement
ConfigurationElement

属性的父元素。

返回

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

注解

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

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

适用于

另请参阅