Udostępnij za pośrednictwem


ConfigurationSection.ShouldSerializeElementInTargetVersion Metoda

Definicja

Wskazuje, czy określony element powinien być serializowany, gdy hierarchia obiektów konfiguracji jest serializowana dla określonej wersji docelowej platformy .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

Parametry

element
ConfigurationElement

ConfigurationElement Obiekt, który jest kandydatem do serializacji.

elementName
String

Nazwa ConfigurationElement obiektu w formacie XML.

targetFramework
FrameworkName

Docelowa wersja platformy .NET Framework.

Zwraca

true element jeśli element powinien być serializowany; w przeciwnym razie false.

Uwagi

Każda sekcja konfiguracji utworzona dla platformy .NET Framework 4 i nowszych wersji musi jawnie zastąpić tę metodę i zwrócić true, ale tylko wtedy, gdy określony element jest prawidłowy dla określonej wersji programu .NET Framework. Nie trzeba zmieniać istniejących sekcji konfiguracji utworzonych dla wcześniejszych wersji programu .NET Framework.

Typ podstawowy zawiera domyślną implementację tej metody, która zawsze zwraca wartość true. Jeśli zaimplementujesz sekcję konfiguracji i nie zastąpisz tej metody, domyślnie wszystkie elementy konfiguracji zawarte w sekcji konfiguracji zostaną serializowane dla wszystkich wersji platformy.

Dotyczy