ConfigurationLocation Klas

Definitie

Vertegenwoordigt een location element in een configuratiebestand.

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

Voorbeelden

In het volgende codevoorbeeld wordt de webconfiguratie voor de toepassing MySampleApp geladen en worden de locaties weergegeven die in de configuratie zijn gedefinieerd.

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

Opmerkingen

Een exemplaar van de ConfigurationLocation klasse vertegenwoordigt één location element in een configuratiebestand. Locaties worden gebruikt om configuratie-instellingen op te geven die alleen van toepassing zijn op een opgegeven resource, zoals een specifieke pagina, bestand of submap, in uw webtoepassing. Gebruik de ConfigurationLocation klasse om het pad en het Configuration object te verkrijgen dat van toepassing is op de opgegeven resource.

Eigenschappen

Name Description
Path

Hiermee haalt u het relatieve pad op naar de resource waarvan de configuratie-instellingen worden vertegenwoordigd door dit ConfigurationLocation object.

Methoden

Name Description
Equals(Object)

Bepaalt of het opgegeven object gelijk is aan het huidige object.

(Overgenomen van Object)
GetHashCode()

Fungeert als de standaardhashfunctie.

(Overgenomen van Object)
GetType()

Hiermee haalt u de Type huidige instantie op.

(Overgenomen van Object)
MemberwiseClone()

Hiermee maakt u een ondiepe kopie van de huidige Object.

(Overgenomen van Object)
OpenConfiguration()

Hiermee maakt u een exemplaar van een configuratieobject.

ToString()

Retourneert een tekenreeks die het huidige object vertegenwoordigt.

(Overgenomen van Object)

Van toepassing op