ConfigurationLocationCollection Class
Contains a collection of ConfigurationLocationCollection objects.
Assembly: System.Configuration (in System.Configuration.dll)
Use the ConfigurationLocationCollection class to iterate through a collection of ConfigurationLocation objects, which represent the resources for which location-specific configuration settings are defined. ConfigurationLocationCollection is the type returned by the Locations property.
Note: |
|---|
The ConfigurationLocationCollection class might not reference the collection of ConfigurationLocation objects in the order that they are specified in the configuration file. |
In the following code example, the Web configuration for the application MySampleApp is loaded, and the locations defined in this configuration are displayed by iterating through the ConfigurationLocationCollection object returned by the Locations property.
Imports System 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 'DisplayLocationInfo
System.Collections.ReadOnlyCollectionBase
System.Configuration.ConfigurationLocationCollection
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note: