Exportar (0) Imprimir
Expandir Tudo
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original

ConfigurationLocationCollection Classe

Contém uma coleção de objetos ConfigurationLocationCollection.

Namespace:  System.Configuration
Assembly:  System.Configuration (em System.Configuration. dll)

public class ConfigurationLocationCollection : ReadOnlyCollectionBase

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.

ObservaçãoObservação:

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.

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();
    }
}


System.Object
  System.Collections.ReadOnlyCollectionBase
    System.Configuration.ConfigurationLocationCollection

Quaisquer membros públicos estático (compartilhados na Visual Basic) desse tipo são Thread seguro. Não há garantia de que qualquer membro de instância seja isento de segmentos.

Contribuições da comunidade

ADICIONAR
Mostrar:
© 2014 Microsoft