ConfigurationSection.ShouldSerializeSectionInTargetVersion(FrameworkName) 方法

定義

表示目前的 ConfigurationSection 執行個體是否應該在組態物件階層架構針對指定的 .NET Framework.NET Framework 目標版本序列化時予以序列化。Indicates whether the current ConfigurationSection instance 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 ShouldSerializeSectionInTargetVersion(System::Runtime::Versioning::FrameworkName ^ targetFramework);
protected internal virtual bool ShouldSerializeSectionInTargetVersion (System.Runtime.Versioning.FrameworkName targetFramework);
abstract member ShouldSerializeSectionInTargetVersion : System.Runtime.Versioning.FrameworkName -> bool
override this.ShouldSerializeSectionInTargetVersion : System.Runtime.Versioning.FrameworkName -> bool
Protected Friend Overridable Function ShouldSerializeSectionInTargetVersion (targetFramework As FrameworkName) As Boolean

參數

targetFramework
FrameworkName

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

傳回

如果應該序列化目前的區段,則為 true,否則為 falsetrue if the current section 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 configuration section 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 the configuration section will be serialized for all framework versions.

適用於

另請參閱