ConfigurationSection.ShouldSerializeElementInTargetVersion Metoda

Definicja

Wskazuje, czy określony element powinien być serializowany, gdy hierarchia obiektów konfiguracji jest serializowana dla określonej wersji docelowej .NET Framework.

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

Zwraca

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

Uwagi

Każda sekcja konfiguracji utworzona dla .NET Framework 4 i nowszych wersji musi jawnie zastąpić tę metodę i zwrócić truewartość , ale tylko wtedy, gdy określony element jest prawidłowy dla określonej wersji .NET Framework. Istniejące sekcje konfiguracji utworzone dla wcześniejszych wersji .NET Framework nie muszą być zmieniane.

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

Zobacz też