ConfigurationSection.ShouldSerializePropertyInTargetVersion 方法

定義

指示當設定物件階層序列化至指定版本的 .NET 框架時,是否應序列化該屬性。

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 框架。

parentConfigurationElement
ConfigurationElement

該物業的父元素。

傳回

true若 應property序列化;否則 。 false

備註

每個為 .NET Framework 4 及以後版本建立的設定區段,必須明確覆寫此方法並回傳 true,但前提是該指定屬性對該 .NET 框架版本有效。 為早期版本 .NET Framework 建立的現有設定區塊無需更改。

基底型態包含此方法的預設實作,且總是回傳 true。 如果你實作一個設定區段且沒有覆蓋此方法,預設情況下,該區段中所有的設定屬性都會序列化,適用於所有框架版本。

適用於