ElementInformation Klasse

Definition

Enthält Metainformationen zu einem einzelnen Element innerhalb der Konfiguration. Diese Klasse kann nicht vererbt werden.

public ref class ElementInformation sealed
public sealed class ElementInformation
type ElementInformation = class
Public NotInheritable Class ElementInformation
Vererbung
ElementInformation

Beispiele

Das folgende Beispiel zeigt, wie das ElementInformation zugeordnete ConfigurationElement Objekt abgerufen wird.

static public ElementInformation
    GetElementInformation()
{

    // Get the current configuration file.
    System.Configuration.Configuration config =
            ConfigurationManager.OpenExeConfiguration(
            ConfigurationUserLevel.None);

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

    // Get the element.
    UrlConfigElement url = section.Simple;

    ElementInformation eInfo =
        url.ElementInformation;

    return eInfo;
}
Public Shared Function GetElementInformation() _
As ElementInformation

    ' Get the current configuration file.
    Dim config _
    As System.Configuration.Configuration = _
    ConfigurationManager.OpenExeConfiguration( _
    ConfigurationUserLevel.None)

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

    ' Get the element.
    Dim url As UrlConfigElement = _
    section.Simple

    Dim eInfo As ElementInformation = _
    url.ElementInformation

    Return eInfo

End Function 'GetElementInformation

Der folgende Auszug zeigt die Konfiguration, die im vorherigen Codebeispiel verwendet wird.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="MyUrls" type="Samples.AspNet.UrlsSection,
      ConfigurationElement, Version=1.0.0.0, Culture=neutral,
      PublicKeyToken=null" allowDefinition="Everywhere"
      allowExeDefinition="MachineToApplication"
      restartOnExternalChanges="true" />
  </configSections>
  <MyUrls name="MyFavorites">
    <simple name="Contoso" url="http://www.contoso.com" port="8080" />
    <urls>
      <clear />
      <add name="Microsoft" url="http://www.microsoft.com" port="0" />
    </urls>
  </MyUrls>
</configuration>

Hinweise

Das ElementInformation Objekt enthält Metainformationen zu einem einzelnen Element innerhalb der Konfiguration. Dieses Objekt kann beim Überprüfen und Ändern der Eigenschaften eines einzelnen Elements verwendet werden.

Eigenschaften

Name Beschreibung
Errors

Ruft die Fehler für das zugeordnete Element und Unterelemente ab.

IsCollection

Ruft einen Wert ab, der angibt, ob das zugeordnete ConfigurationElement Objekt eine ConfigurationElementCollection Auflistung ist.

IsLocked

Ruft einen Wert ab, der angibt, ob das zugeordnete ConfigurationElement Objekt nicht geändert werden kann.

IsPresent

Ruft einen Wert ab, der angibt, ob sich das zugeordnete ConfigurationElement Objekt in der Konfigurationsdatei befindet.

LineNumber

Ruft die Zeilennummer in der Konfigurationsdatei ab, in der das zugeordnete ConfigurationElement Objekt definiert ist.

Properties

Ruft eine PropertyInformationCollection Auflistung der Eigenschaften im zugeordneten ConfigurationElement Objekt ab.

Source

Ruft die Quelldatei ab, in der das zugeordnete ConfigurationElement Objekt stammt.

Type

Ruft den Typ des zugeordneten ConfigurationElement Objekts ab.

Validator

Ruft das Objekt ab, das zum Überprüfen des zugeordneten ConfigurationElement Objekts verwendet wird.

Methoden

Name Beschreibung
Equals(Object)

Bestimmt, ob das angegebene Objekt dem aktuellen Objekt entspricht.

(Geerbt von Object)
GetHashCode()

Dient als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft die Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie der aktuellen Object.

(Geerbt von Object)
ToString()

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

(Geerbt von Object)

Gilt für:

Weitere Informationen