共用方式為


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

顯示在 XML 中的 ConfigurationProperty 物件名稱。

targetFramework
FrameworkName

.NET Framework 的目標版本。

parentConfigurationElement
ConfigurationElement

屬性的父項目。

傳回

如果應該序列化 property,則為 true,否則為 false

備註

針對 .NET Framework 4 和更新版本所建立的每個組態區段都必須明確覆寫這個方法並傳回 true,但只有在指定的屬性對指定版本的 .NET Framework 有效時才有效。 為舊版 .NET Framework 建立的現有組態區段不需要變更。

基底類型包含這個方法的預設實作,一律會傳 true回 。 如果您實作組態區段且未覆寫此方法,則所有組態區段中所包含的組態屬性預設都會針對所有架構版本串行化。

適用於

另請參閱