ConfigurationLocation Klasse

Definition

Stellt ein location-Element innerhalb einer Konfigurationsdatei dar.

public ref class ConfigurationLocation
public class ConfigurationLocation
type ConfigurationLocation = class
Public Class ConfigurationLocation
Vererbung
ConfigurationLocation

Beispiele

Im folgenden Codebeispiel wird die Webkonfiguration für die Anwendung MySampleApp geladen, und dann werden die in der Konfiguration definierten Speicherorte angezeigt.

using System;
using System.Collections;
using System.Configuration;

class DisplayLocationInfo
{
    static void Main(string[] args)
    {
        Configuration config = 
            ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
        ConfigurationLocationCollection myLocationCollection = config.Locations;
        foreach (ConfigurationLocation myLocation in myLocationCollection)
        {
            Console.WriteLine("Location Path: {0}", myLocation.Path);
            Configuration myLocationConfiguration = myLocation.OpenConfiguration();
            Console.WriteLine("Location Configuration File Path: {0}",
                myLocationConfiguration.FilePath);
        }
        Console.WriteLine("Done...");
        Console.ReadLine();
    }
}
Imports System.Collections
Imports System.Configuration

Class DisplayLocationInfo
    Public Overloads Shared Sub Main()
        Dim config As System.Configuration.Configuration = _
            ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
        Dim myLocationCollection As _
            System.Configuration.ConfigurationLocationCollection = config.Locations
        Dim myLocation As ConfigurationLocation
        For Each myLocation In  myLocationCollection
            Console.WriteLine("Location Path: {0}", myLocation.Path)
            Dim myLocationConfiguration As System.Configuration.Configuration = _
                myLocation.OpenConfiguration()
            Console.WriteLine("Location Configuration Path: {0}", _
                myLocationConfiguration.FilePath)
        Next myLocation
        Console.WriteLine("Done...")
        Console.ReadLine()
    End Sub
End Class

Hinweise

Eine Instanz der ConfigurationLocation Klasse stellt ein einzelnes location Element in einer Konfigurationsdatei dar. Speicherorte werden verwendet, um Konfigurationseinstellungen anzugeben, die nur für eine angegebene Ressource gelten, z. B. eine bestimmte Seite, Eine Datei oder ein Unterverzeichnis in Ihrer Webanwendung. Verwenden Sie die ConfigurationLocation Klasse, um den Pfad und das Objekt abzurufen, das Configuration für die angegebene Ressource gilt.

Eigenschaften

Path

Ruft den relativen Pfad zur Ressource ab, deren Konfigurationseinstellungen von diesem ConfigurationLocation-Objekt dargestellt werden.

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)
OpenConfiguration()

Erstellt eine Instanz eines Konfigurationsobjekts.

ToString()

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

(Geerbt von Object)

Gilt für