通过


ConfigurationSection.ShouldSerializeElementInTargetVersion 方法

定义

指示在为 .NET Framework 的指定目标版本序列化配置对象层次结构时,是否应序列化指定的元素。

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 Framework 的目标版本。

返回

true 如果应序列化, element 则为 .;否则为 false

注解

为 .NET Framework 4 及更高版本创建的每个配置节必须显式重写此方法并返回 true,但前提是指定的元素对 .NET Framework 的指定版本有效。 为早期版本的 .NET Framework 创建的现有配置节不必更改。

基类型包含此方法的默认实现,该方法始终返回 true。 如果实现配置节并且不重写此方法,则默认情况下,所有框架版本都包含在配置节中的所有配置元素都将序列化。

适用于