ElementInformation Klasse

Definition

Enthält Metainformationen über ein einzelnes 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

Im folgenden Beispiel wird gezeigt, wie Sie das ElementInformation einem ConfigurationElement -Objekt zugeordnete abrufen.

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 wurde.

<?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

Errors

Ruft die Fehler für das zugeordnete Element und die 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, bei der das zugeordnete ConfigurationElement-Objekt definiert wird.

Properties

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

Source

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

Type

Ruft den dem ConfigurationElement-Objekt zugeordneten Typ ab.

Validator

Ruft das Objekt ab, mit dem das zugeordnete ConfigurationElement-Objekt validiert wird.

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

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

(Geerbt von Object)

Gilt für:

Weitere Informationen