ConfigurationElement Klasse

Definition

Stellt ein Konfigurationselement innerhalb einer Konfigurationsdatei dar.

public ref class ConfigurationElement abstract
public abstract class ConfigurationElement
type ConfigurationElement = class
Public MustInherit Class ConfigurationElement
Vererbung
ConfigurationElement
Abgeleitet

Beispiele

Im folgenden Codebeispiel wird gezeigt, wie ein benutzerdefiniertes ConfigurationElement Element sowohl als einzelnes Element in einem benutzerdefinierten Abschnitt als auch als Auflistung von Elementen in einem benutzerdefinierten Abschnitt implementiert wird. Das Beispiel besteht aus den folgenden Dateien:

  • Eine app.config-Datei, die einen benutzerdefinierten Abschnitt mit dem Namen MyUrlsenthält. Dieser Abschnitt enthält ein einfaches Element (er enthält keine anderen Elemente) und eine Auflistung von Elementen. Das einfache Element hat den Namen simple , und die Auflistung heißt urls.

  • Eine Konsolenanwendung. Die Anwendung liest den Inhalt der app.config-Datei und schreibt die Informationen in die Konsole. Es werden Klassen verwendet, die von , ConfigurationElementCollectionund ConfigurationSectionabgeleitet werdenConfigurationElement.

  • Eine Klasse namens UrlsSection , die von der ConfigurationSection -Klasse abgeleitet wird. Diese Klasse wird verwendet, um auf den MyUrls Abschnitt in der Konfigurationsdatei zuzugreifen.

  • Eine Klasse namens UrlsCollection , die von der ConfigurationElementCollection -Klasse abgeleitet wird. Diese Klasse wird verwendet, um auf die urls Auflistung in der Konfigurationsdatei zuzugreifen.

  • Eine Klasse namens UrlConfigElement , die von der ConfigurationElement -Klasse abgeleitet wird. Diese Klasse wird verwendet, um auf das simple Element und die Member der urls Auflistung in der Konfigurationsdatei zuzugreifen.

Führen Sie zum Ausführen des Beispiels die folgenden Schritte aus:

  1. Erstellen Sie eine Projektmappe mit einem Konsolenanwendungsprojekt und einem Klassenbibliotheksprojekt mit dem Namen ConfigurationElement.

  2. Platzieren Sie die drei Klassendateien im Klassenbibliotheksprojekt, und fügen Sie die anderen Dateien im Konsolenbibliotheksprojekt ab.

  3. Legen Sie in beiden Projekten einen Verweis auf fest System.Configuration.

  4. Legen Sie im Konsolenanwendungsprojekt einen Projektverweis auf das Klassenbibliotheksprojekt fest.

// Set Assembly name to ConfigurationElement
using System;
using System.Configuration;
using System.Collections;

namespace Samples.AspNet
{
    // Entry point for console application that reads the 
    // app.config file and writes to the console the 
    // URLs in the custom section.  
    class TestConfigurationElement
    {
        static void Main(string[] args)
        {
            // Get current configuration file.
            System.Configuration.Configuration config =
                ConfigurationManager.OpenExeConfiguration(
                ConfigurationUserLevel.None);

            // Get the MyUrls section.
            UrlsSection myUrlsSection =
                config.GetSection("MyUrls") as UrlsSection;

            if (myUrlsSection == null)
            {
                Console.WriteLine("Failed to load UrlsSection.");
            }
            else
            {
                Console.WriteLine("The 'simple' element of app.config:");
                Console.WriteLine("  Name={0} URL={1} Port={2}",
                    myUrlsSection.Simple.Name,
                    myUrlsSection.Simple.Url,
                    myUrlsSection.Simple.Port);

                Console.WriteLine("The urls collection of app.config:");
                for (int i = 0; i < myUrlsSection.Urls.Count; i++)
                {
                    Console.WriteLine("  Name={0} URL={1} Port={2}",
                        myUrlsSection.Urls[i].Name,
                        myUrlsSection.Urls[i].Url,
                        myUrlsSection.Urls[i].Port);
                }
            }
            Console.ReadLine();
        }
    }
}
' Set Assembly name to ConfigurationElement
' and set Root namespace to Samples.AspNet
Imports System.Configuration
Imports System.Collections

Class TestConfigurationElement
    ' Entry point for console application that reads the 
    ' app.config file and writes to the console the 
    ' URLs in the custom section.
    Shared Sub Main(ByVal args() As String)
        ' Get the current configuration file.
        Dim config As System.Configuration.Configuration = _
            ConfigurationManager.OpenExeConfiguration( _
            ConfigurationUserLevel.None)

        ' Get the MyUrls section.
        Dim myUrlsSection As UrlsSection = _
            config.GetSection("MyUrls")

        If myUrlsSection Is Nothing Then
            Console.WriteLine("Failed to load UrlsSection.")
        Else
            Console.WriteLine("The 'simple' element of app.config:")
            Console.WriteLine("  Name={0} URL={1} Port={2}", _
                myUrlsSection.Simple.Name, _
                myUrlsSection.Simple.Url, _
                myUrlsSection.Simple.Port)
            Console.WriteLine("The urls collection of app.config:")
            Dim i As Integer
            For i = 0 To myUrlsSection.Urls.Count - 1
                Console.WriteLine("  Name={0} URL={1} Port={2}", _
                i, myUrlsSection.Urls(i).Name, _
                myUrlsSection.Urls(i).Url, _
                myUrlsSection.Urls(i).Port)
            Next i
        End If
        Console.ReadLine()
    End Sub
End Class
using System;
using System.Configuration;
using System.Collections;

namespace Samples.AspNet
{
    // Define a custom section containing an individual
    // element and a collection of elements.
    public class UrlsSection : ConfigurationSection
    {
        [ConfigurationProperty("name", 
            DefaultValue = "MyFavorites",
            IsRequired = true, 
            IsKey = false)]
        [StringValidator(InvalidCharacters = 
            " ~!@#$%^&*()[]{}/;'\"|\\",
            MinLength = 1, MaxLength = 60)]
        public string Name
        {

            get
            {
                return (string)this["name"];
            }
            set
            {
                this["name"] = value;
            }
        }

        // Declare an element (not in a collection) of the type
        // UrlConfigElement. In the configuration
        // file it corresponds to <simple .... />.
        [ConfigurationProperty("simple")]
        public UrlConfigElement Simple
        {
            get
            {
                UrlConfigElement url =
                (UrlConfigElement)base["simple"];
                return url;
            }
        }

        // Declare a collection element represented 
        // in the configuration file by the sub-section
        // <urls> <add .../> </urls> 
        // Note: the "IsDefaultCollection = false" 
        // instructs the .NET Framework to build a nested 
        // section like <urls> ...</urls>.
        [ConfigurationProperty("urls",
            IsDefaultCollection = false)]
        public UrlsCollection Urls
        {
            get
            {
                UrlsCollection urlsCollection =
                (UrlsCollection)base["urls"];
                return urlsCollection;
            }
        }

        protected override void DeserializeSection(
            System.Xml.XmlReader reader)
        {
            base.DeserializeSection(reader);
            // You can add custom processing code here.
        }

        protected override string SerializeSection(
            ConfigurationElement parentElement,
            string name, ConfigurationSaveMode saveMode)
        {
            string s =
                base.SerializeSection(parentElement,
                name, saveMode);
            // You can add custom processing code here.
            return s;
        }
    }
}
Imports System.Configuration
Imports System.Collections

' Define a custom section containing an individual
' element and a collection of elements.
Public Class UrlsSection
    Inherits ConfigurationSection

    <ConfigurationProperty("name", _
        DefaultValue:="MyFavorites", _
        IsRequired:=True, _
        IsKey:=False), _
        StringValidator( _
        InvalidCharacters:=" ~!@#$%^&*()[]{}/;'""|\", _
        MinLength:=1, MaxLength:=60)> _
        Public Property Name() As String

        Get
            Return CStr(Me("name"))
        End Get
        Set(ByVal value As String)
            Me("name") = value
        End Set
    End Property
    
    ' Declare an element (not in a collection) of the type
    ' UrlConfigElement. In the configuration
    ' file it corresponds to <simple .... />.
    <ConfigurationProperty("simple")> _
        Public ReadOnly Property Simple() _
        As UrlConfigElement

        Get
            Dim url As UrlConfigElement = _
                CType(Me("simple"),  _
                UrlConfigElement)
            Return url
        End Get
    End Property
    
    ' Declare a collection element represented 
    ' in the configuration file by the sub-section
    ' <urls> <add .../> </urls> 
    ' Note: the "IsDefaultCollection = false" 
    ' instructs the .NET Framework to build a nested 
    ' section like <urls> ...</urls>.
    <ConfigurationProperty("urls", _
        IsDefaultCollection:=False)> _
        Public ReadOnly Property Urls() _
        As UrlsCollection

        Get
            Dim urlsCollection _
                As UrlsCollection = _
                CType(Me("urls"), UrlsCollection)
            Return urlsCollection
        End Get
    End Property

    Protected Overrides Sub DeserializeSection( _
        ByVal reader As System.Xml.XmlReader)

        MyBase.DeserializeSection(reader)
        ' Enter your custom processing code here.
    End Sub

    Protected Overrides Function SerializeSection( _
        ByVal parentElement As ConfigurationElement, _
        ByVal name As String, _
        ByVal saveMode As ConfigurationSaveMode) As String

        Dim s As String = _
            MyBase.SerializeSection(parentElement, _
            name, saveMode)
        ' Enter your custom processing code here.
        Return s
    End Function 'SerializeSection
End Class
using System;
using System.Configuration;
using System.Collections;

namespace Samples.AspNet
{
    public class UrlsCollection : ConfigurationElementCollection
    {
        public UrlsCollection()
        {
            // Add one url to the collection.  This is
            // not necessary; could leave the collection 
            // empty until items are added to it outside
            // the constructor.
            UrlConfigElement url = 
                (UrlConfigElement)CreateNewElement();
            Add(url);
        }

        public override 
            ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return 

                    ConfigurationElementCollectionType.AddRemoveClearMap;
            }
        }

        protected override 
            ConfigurationElement CreateNewElement()
        {
            return new UrlConfigElement();
        }

        protected override 
            ConfigurationElement CreateNewElement(
            string elementName)
        {
            return new UrlConfigElement(elementName);
        }

        protected override Object 
            GetElementKey(ConfigurationElement element)
        {
            return ((UrlConfigElement)element).Name;
        }

        public new string AddElementName
        {
            get
            { return base.AddElementName; }

            set
            { base.AddElementName = value; }
        }

        public new string ClearElementName
        {
            get
            { return base.ClearElementName; }

            set
            { base.ClearElementName = value; }
        }

        public new string RemoveElementName
        {
            get
            { return base.RemoveElementName; }
        }

        public new int Count
        {
            get { return base.Count; }
        }

        public UrlConfigElement this[int index]
        {
            get
            {
                return (UrlConfigElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public UrlConfigElement this[string Name]
        {
            get
            {
                return (UrlConfigElement)BaseGet(Name);
            }
        }

        public int IndexOf(UrlConfigElement url)
        {
            return BaseIndexOf(url);
        }

        public void Add(UrlConfigElement url)
        {
            BaseAdd(url);
            // Add custom code here.
        }

        protected override void 
            BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
            // Add custom code here.
        }

        public void Remove(UrlConfigElement url)
        {
            if (BaseIndexOf(url) >= 0)
                BaseRemove(url.Name);
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string name)
        {
            BaseRemove(name);
        }

        public void Clear()
        {
            BaseClear();
            // Add custom code here.
        }
    }
}
Imports System.Configuration
Imports System.Collections

Public Class UrlsCollection
    Inherits ConfigurationElementCollection

    Public Sub New()
        ' Add one url to the collection.  This is
        ' not necessary; could leave the collection 
        ' empty until items are added to it outside
        ' the constructor.
        Dim url As UrlConfigElement = _
            CType(CreateNewElement(), UrlConfigElement)
        ' Add the element to the collection.
        Add(url)
    End Sub

    Public Overrides ReadOnly Property CollectionType() _
        As ConfigurationElementCollectionType

        Get
            Return ConfigurationElementCollectionType.AddRemoveClearMap
        End Get
    End Property

    Protected Overloads Overrides Function CreateNewElement() _
        As ConfigurationElement

        Return New UrlConfigElement()
    End Function 'CreateNewElement

    Protected Overloads Overrides Function CreateNewElement( _
        ByVal elementName As String) _
        As ConfigurationElement

        Return New UrlConfigElement(elementName)
    End Function 'CreateNewElement

    Protected Overrides Function GetElementKey( _
        ByVal element As ConfigurationElement) As [Object]

        Return CType(element, UrlConfigElement).Name
    End Function 'GetElementKey

    Public Shadows Property AddElementName() As String

        Get
            Return MyBase.AddElementName
        End Get

        Set(ByVal value As String)
            MyBase.AddElementName = value
        End Set
    End Property

    Public Shadows Property ClearElementName() As String
        Get
            Return MyBase.ClearElementName
        End Get

        Set(ByVal value As String)
            MyBase.ClearElementName = value
        End Set
    End Property

    Public Shadows ReadOnly Property RemoveElementName() As String
        Get
            Return MyBase.RemoveElementName
        End Get
    End Property

    Public Shadows ReadOnly Property Count() As Integer
        Get
            Return MyBase.Count
        End Get
    End Property

    Default Public Shadows Property Item( _
    ByVal index As Integer) As UrlConfigElement
        Get
            Return CType(BaseGet(index), UrlConfigElement)
        End Get

        Set(ByVal value As UrlConfigElement)
            If Not (BaseGet(index) Is Nothing) Then
                BaseRemoveAt(index)
            End If
            BaseAdd(index, value)
        End Set
    End Property

    Default Public Shadows ReadOnly Property Item( _
        ByVal Name As String) As UrlConfigElement

        Get
            Return CType(BaseGet(Name), UrlConfigElement)
        End Get
    End Property

    Public Function IndexOf( _
        ByVal url As UrlConfigElement) As Integer

        Return BaseIndexOf(url)
    End Function 'IndexOf

    Public Sub Add(ByVal url As UrlConfigElement)
        BaseAdd(url)
        ' Add custom code here.
    End Sub

    Protected Overrides Sub BaseAdd( _
    ByVal element As ConfigurationElement)
        BaseAdd(element, False)
        ' Add custom code here.
    End Sub

    Public Overloads Sub Remove( _
        ByVal url As UrlConfigElement)

        If BaseIndexOf(url) >= 0 Then
            BaseRemove(url.Name)
        End If
    End Sub

    Public Sub RemoveAt(ByVal index As Integer)
        BaseRemoveAt(index)
    End Sub

    Public Overloads Sub Remove(ByVal name As String)
        BaseRemove(name)
    End Sub

    Public Sub Clear()
        BaseClear()
    End Sub
End Class
using System;
using System.Configuration;
using System.Collections;

namespace Samples.AspNet
{
    public class UrlConfigElement : ConfigurationElement
    {
        // Constructor allowing name, url, and port to be specified.
        public UrlConfigElement(String newName,
            String newUrl, int newPort)
        {
            Name = newName;
            Url = newUrl;
            Port = newPort;
        }

        // Default constructor, will use default values as defined
        // below.
        public UrlConfigElement()
        {
        }

        // Constructor allowing name to be specified, will take the
        // default values for url and port.
        public UrlConfigElement(string elementName)
        {
            Name = elementName;
        }

        [ConfigurationProperty("name", 
            DefaultValue = "Microsoft",
            IsRequired = true, 
            IsKey = true)]
        public string Name
        {
            get
            {
                return (string)this["name"];
            }
            set
            {
                this["name"] = value;
            }
        }

        [ConfigurationProperty("url",
            DefaultValue = "http://www.microsoft.com",
            IsRequired = true)]
        [RegexStringValidator(@"\w+:\/\/[\w.]+\S*")]
        public string Url
        {
            get
            {
                return (string)this["url"];
            }
            set
            {
                this["url"] = value;
            }
        }

        [ConfigurationProperty("port",
            DefaultValue = (int)0,
            IsRequired = false)]
        [IntegerValidator(MinValue = 0,
            MaxValue = 8080, ExcludeRange = false)]
        public int Port
        {
            get
            {
                return (int)this["port"];
            }
            set
            {
                this["port"] = value;
            }
        }

        protected override void DeserializeElement(
           System.Xml.XmlReader reader, 
            bool serializeCollectionKey)
        {
            base.DeserializeElement(reader, 
                serializeCollectionKey);
            // You can your custom processing code here.
        }

        protected override bool SerializeElement(
            System.Xml.XmlWriter writer, 
            bool serializeCollectionKey)
        {
            bool ret = base.SerializeElement(writer, 
                serializeCollectionKey);
            // You can enter your custom processing code here.
            return ret;
        }

        protected override bool IsModified()
        {
            bool ret = base.IsModified();
            // You can enter your custom processing code here.
            return ret;
        }
    }
}
Imports System.Configuration
Imports System.Collections

Public Class UrlConfigElement
    Inherits ConfigurationElement

    ' Constructor allowing name, url, and port to be specified.
    Public Sub New(ByVal newName As String, _
        ByVal newUrl As String, _
        ByVal newPort As Integer)

        Name = newName
        Url = newUrl
        Port = newPort

    End Sub

    ' Default constructor, will use default values as defined
    Public Sub New()

    End Sub


    ' Constructor allowing name to be specified, will take the
    ' default values for url and port.
    Public Sub New(ByVal elementName As String)
        Name = elementName

    End Sub


    <ConfigurationProperty("name", _
        DefaultValue:="Microsoft", _
        IsRequired:=True, _
        IsKey:=True)> _
        Public Property Name() As String

        Get
            Return CStr(Me("name"))
        End Get
        Set(ByVal value As String)
            Me("name") = value
        End Set
    End Property


    <ConfigurationProperty("url", _
        DefaultValue:="http://www.microsoft.com", _
        IsRequired:=True), _
        RegexStringValidator("\w+:\/\/[\w.]+\S*")> _
        Public Property Url() As String

        Get
            Return CStr(Me("url"))
        End Get
        Set(ByVal value As String)
            Me("url") = value
        End Set
    End Property


    <ConfigurationProperty("port", _
        DefaultValue:=0, _
        IsRequired:=False), _
        IntegerValidator(MinValue:=0, _
        MaxValue:=8080, ExcludeRange:=False)> _
        Public Property Port() As Integer

        Get
            Return Fix(Me("port"))
        End Get
        Set(ByVal value As Integer)
            Me("port") = value
        End Set
    End Property


    Protected Overrides Sub DeserializeElement(ByVal reader _
        As System.Xml.XmlReader, _
        ByVal serializeCollectionKey As Boolean)

        MyBase.DeserializeElement(reader, _
            serializeCollectionKey)
        ' Enter your custom processing code here.
    End Sub

    Protected Overrides Function SerializeElement(ByVal writer _
        As System.Xml.XmlWriter, _
        ByVal serializeCollectionKey As Boolean) As Boolean

        Dim ret As Boolean = _
            MyBase.SerializeElement(writer, serializeCollectionKey)
        ' Enter your custom processing code here.
        Return ret
    End Function 'SerializeElement

    Protected Overrides Function IsModified() As Boolean
        Dim ret As Boolean = MyBase.IsModified()
        ' Enter your custom processing code here.
        Return ret

    End Function 'IsModified
End Class

Hinweise

ist ConfigurationElement eine abstrakte Klasse, die verwendet wird, um ein XML-Element in einer Konfigurationsdatei darzustellen (z. B. Web.config). Ein Element in einer Konfigurationsdatei kann null, ein oder mehrere untergeordnete Elemente enthalten.

Da die ConfigurationElement Klasse als abstrakt definiert ist, können Sie keine instance davon erstellen. Sie können nur Klassen daraus ableiten. Die .NET Framework enthält Klassen, die von der ConfigurationElement -Klasse abgeleitet werden, um XML-Standardkonfigurationselemente ConfigurationSectionwie darzustellen. Sie können die ConfigurationElement -Klasse auch erweitern, um auf benutzerdefinierte Konfigurationselemente und Abschnitte zuzugreifen. Das weiter unten in diesem Thema enthaltene Beispiel zeigt, wie Sie mithilfe benutzerdefinierter Klassen, die von ConfigurationElementabgeleitet werden, auf benutzerdefinierte Konfigurationselemente und Abschnitte zugreifen.

Sie können auch die Standardkonfigurationstypen wie ConfigurationElement, , ConfigurationElementCollectionConfigurationPropertyund ConfigurationSectionerweitern. Weitere Informationen finden Sie in der Dokumentation zu diesen Klassen.

Weitere Informationen zum Zugreifen auf Informationen in Konfigurationsdateien finden Sie in der ConfigurationManager -Klasse und der WebConfigurationManager -Klasse.

Hinweise für Ausführende

Jedes ConfigurationElement Objekt erstellt eine interne ConfigurationPropertyCollection Auflistung von ConfigurationProperty -Objekten, die entweder die Elementattribute oder eine Auflistung von untergeordneten Elementen darstellt.

Nicht anpassbare Informationen und Funktionen sind in einem ElementInformation Objekt enthalten, das von der ElementInformation -Eigenschaft bereitgestellt wird.

Sie können entweder ein programmgesteuertes oder ein deklaratives (attributiertes) Codierungsmodell verwenden, um ein benutzerdefiniertes Konfigurationselement zu erstellen:

  • Das programmgesteuerte Modell erfordert, dass Sie für jedes Elementattribute eine Eigenschaft erstellen, um ihren Wert abzurufen oder festzulegen und ihn dem internen Eigenschaftenbehälter der zugrunde liegenden ConfigurationElement Basisklasse hinzuzufügen. Ein Beispiel für die Verwendung dieses Modells finden Sie in der ConfigurationSection -Klasse.

  • Mit dem einfacheren deklarativen Modell, das auch als attributiertes Modell bezeichnet wird, können Sie ein Elementattribute mithilfe einer -Eigenschaft definieren und es dann mit Attributen ergänzen. Diese Attribute weisen das ASP.NET-Konfigurationssystem über die Eigenschaftentypen und deren Standardwerte an. Mit diesen Informationen, die durch Reflektion abgerufen werden, erstellt das ASP.NET-Konfigurationssystem die Elementeigenschaftsobjekte für Sie und führt die erforderliche Initialisierung aus. Das weiter unten in diesem Thema gezeigte Beispiel veranschaulicht die Verwendung dieses Modells.

Konstruktoren

ConfigurationElement()

Initialisiert eine neue Instanz der ConfigurationElement-Klasse.

Eigenschaften

CurrentConfiguration

Ruft einen Verweis auf die Configuration-Instanz der obersten Ebene ab, die die Konfigurationshierarchie darstellt, zu der die aktuelle ConfigurationElement-Instanz gehört.

ElementInformation

Ruft ein ElementInformation-Objekt ab, das die nicht anpassbaren Informationen und Funktionen des ConfigurationElement-Objekts enthält.

ElementProperty

Ruft das ConfigurationElementProperty-Objekt ab, das das ConfigurationElement-Objekt selbst darstellt.

EvaluationContext

Ruft das ContextInformation-Objekt für das ConfigurationElement-Objekt ab.

HasContext

Ruft einen Wert ab, der angibt, ob die CurrentConfiguration-Eigenschaft null ist.

Item[ConfigurationProperty]

Ruft eine Eigenschaft oder ein Attribut dieses Konfigurationselements ab oder legt diese bzw. dieses fest.

Item[String]

Ruft eine Eigenschaft, ein Attribut oder ein untergeordnetes Element dieses Konfigurationselements ab oder legt diese(s) fest.

LockAllAttributesExcept

Ruft die Auflistung gesperrter Attribute ab.

LockAllElementsExcept

Ruft die Auflistung gesperrter Elemente ab.

LockAttributes

Ruft die Auflistung gesperrter Attribute ab.

LockElements

Ruft die Auflistung gesperrter Elemente ab.

LockItem

Ruft einen Wert ab, der angibt, ob das Element gesperrt ist, oder legt diesen fest.

Properties

Ruft die Auflistung von Eigenschaften ab.

Methoden

DeserializeElement(XmlReader, Boolean)

Liest XML aus der Konfigurationsdatei.

Equals(Object)

Vergleicht die aktuelle ConfigurationElement-Instanz mit dem angegebenen Objekt.

GetHashCode()

Ruft einen eindeutigen Wert ab, der die aktuelle ConfigurationElement-Instanz darstellt.

GetTransformedAssemblyString(String)

Gibt die transformierte Version des angegebenen Assemblynamens zurück.

GetTransformedTypeString(String)

Gibt die transformierte Version des angegebenen Typnamens zurück.

GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
Init()

Legt für das ConfigurationElement-Objekt den Ausgangszustand fest.

InitializeDefault()

Wird verwendet, um einen Standardsatz von Werten für das ConfigurationElement-Objekt zu initialisieren.

IsModified()

Gibt an, ob dieses Konfigurationselement geändert wurde, seit es zuletzt gespeichert oder geladen wurde, wenn es in einer abgeleiteten Klasse implementiert wurde.

IsReadOnly()

Ruft einen Wert ab, der angibt, ob das ConfigurationElement schreibgeschützt ist.

ListErrors(IList)

Fügt die Fehler über ungültige Eigenschaften in diesem ConfigurationElement-Objekt und in allen Unterelementen der übergebenen Liste hinzu.

MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
OnDeserializeUnrecognizedAttribute(String, String)

Ruft einen Wert ab, der angibt, ob während der Deserialisierung ein unbekanntes Attribut aufgetreten ist.

OnDeserializeUnrecognizedElement(String, XmlReader)

Ruft einen Wert ab, der angibt, ob während der Deserialisierung ein unbekanntes Element aufgetreten ist.

OnRequiredPropertyNotFound(String)

Löst eine Ausnahme aus, wenn eine erforderliche Eigenschaft nicht gefunden wird.

PostDeserialize()

Wird nach der Deserialisierung aufgerufen.

PreSerialize(XmlWriter)

Wird vor der Serialisierung aufgerufen.

Reset(ConfigurationElement)

Setzt den internen Status dieses ConfigurationElement-Objekts zurück, einschließlich der Sperren und der Eigenschaftenauflistungen.

ResetModified()

Setzt bei Implementierung in einer abgeleiteten Klasse den Wert der IsModified()-Methode auf false zurück.

SerializeElement(XmlWriter, Boolean)

Schreibt bei Implementierung in einer abgeleiteten Klasse den Inhalt dieses Konfigurationselements in die Konfigurationsdatei.

SerializeToXmlElement(XmlWriter, String)

Schreibt bei Implementierung in einer abgeleiteten Klasse die äußeren Tags dieses Konfigurationselements in die Konfigurationsdatei.

SetPropertyValue(ConfigurationProperty, Object, Boolean)

Legt eine Eigenschaft auf den angegebenen Wert fest.

SetReadOnly()

Legt die IsReadOnly()-Eigenschaft für das ConfigurationElement-Objekt und alle Unterelemente fest.

ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

Ändert das ConfigurationElement-Objekt, um alle Werte zu entfernen, die nicht gespeichert werden sollen.

Gilt für:

Weitere Informationen