ConfigurationSection.ShouldSerializeElementInTargetVersion(ConfigurationElement, String, FrameworkName) 方法

定義

表示指定的項目是否應該在組態物件階層架構針對指定的 .NET Framework.NET Framework 目標版本序列化時予以序列化。Indicates whether the specified element 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 ShouldSerializeElementInTargetVersion(System::Configuration::ConfigurationElement ^ element, System::String ^ elementName, System::Runtime::Versioning::FrameworkName ^ targetFramework);
protected internal virtual bool ShouldSerializeElementInTargetVersion (System.Configuration.ConfigurationElement element, string elementName, System.Runtime.Versioning.FrameworkName targetFramework);
abstract member ShouldSerializeElementInTargetVersion : System.Configuration.ConfigurationElement * string * System.Runtime.Versioning.FrameworkName -> bool
override this.ShouldSerializeElementInTargetVersion : System.Configuration.ConfigurationElement * string * System.Runtime.Versioning.FrameworkName -> bool
Protected Friend Overridable Function ShouldSerializeElementInTargetVersion (element As ConfigurationElement, elementName As String, targetFramework As FrameworkName) As Boolean

參數

element
ConfigurationElement

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

elementName
String

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

targetFramework
FrameworkName

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

傳回

如果應該序列化 element,則為 true,否則為 falsetrue if the element 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 element 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 elements that are contained in the configuration section will be serialized for all framework versions.

適用於

另請參閱