ConfigurationSection.ShouldSerializePropertyInTargetVersion(ConfigurationProperty, String, FrameworkName, ConfigurationElement) ConfigurationSection.ShouldSerializePropertyInTargetVersion(ConfigurationProperty, String, FrameworkName, ConfigurationElement) ConfigurationSection.ShouldSerializePropertyInTargetVersion(ConfigurationProperty, String, FrameworkName, ConfigurationElement) ConfigurationSection.ShouldSerializePropertyInTargetVersion(ConfigurationProperty, String, FrameworkName, ConfigurationElement) Method

定義

表示指定的屬性是否應該在組態物件階層架構針對指定的 .NET Framework.NET Framework 目標版本序列化時予以序列化。Indicates whether the specified property 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 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);
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

參數

property
ConfigurationProperty ConfigurationProperty ConfigurationProperty ConfigurationProperty

可供序列化的候選 ConfigurationProperty 物件。The ConfigurationProperty object that is a candidate for serialization.

propertyName
String String String String

顯示在 XML 中的 ConfigurationProperty 物件名稱。The name of the ConfigurationProperty object as it occurs in XML.

targetFramework
FrameworkName FrameworkName FrameworkName FrameworkName

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

parentConfigurationElement
ConfigurationElement ConfigurationElement ConfigurationElement ConfigurationElement

屬性的父項目。The parent element of the property.

傳回

如果應該序列化 property,則為 true,否則為 falsetrue if the property 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 specified property 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.

基底類型包含這個方法的預設實值,一律true會傳回。The base type contains a default implementation of this method that always returns true. 如果您執行設定區段,但未覆寫此方法,則設定區段中包含的所有設定屬性預設都會針對所有 framework 版本進行序列化。If you implement a configuration section and you do not override this method, by default all configuration properties that are contained in the configuration section will be serialized for all framework versions.

適用於

另請參閱