ConfigurationSection.ShouldSerializeElementInTargetVersion 方法

定義

表示當設定物件階層序列化至指定目標版本的 .NET 框架時,是否應序列化該元素。

protected public:
 virtual bool ShouldSerializeElementInTargetVersion(System::Configuration::ConfigurationElement ^ element, System::String ^ elementName, System::Runtime::Versioning::FrameworkName ^ targetFramework);
protected:
 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);
protected 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
Protected Overridable Function ShouldSerializeElementInTargetVersion (element As ConfigurationElement, elementName As String, targetFramework As FrameworkName) As Boolean

參數

element
ConfigurationElement

ConfigurationElement 被列為序列化候選的物件。

elementName
String

物件名稱在 XML 中出現時的樣 ConfigurationElement 貌。

targetFramework
FrameworkName

目標版本的 .NET 框架。

傳回

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

備註

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

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

適用於