Configuration.GetSection Método

Definição

Retorna a seção de configuração.

Sobrecargas

GetSection(String)

Retorna a seção de configuração usando o caminho da seção especificado.

GetSection(String, String)

Retorna a seção de configuração usando a seção especificada e os caminhos de localização.

GetSection(String, Type)

Retorna uma seção de configuração fortemente tipada usando o caminho de seção especificado.

GetSection(String, Type, String)

Retorna uma seção de configuração fortemente tipada usando a seção especificada e os caminhos de localização.

GetSection(String)

Retorna a seção de configuração usando o caminho da seção especificado.

public:
 Microsoft::Web::Administration::ConfigurationSection ^ GetSection(System::String ^ sectionPath);
public Microsoft.Web.Administration.ConfigurationSection GetSection (string sectionPath);
member this.GetSection : string -> Microsoft.Web.Administration.ConfigurationSection
Public Function GetSection (sectionPath As String) As ConfigurationSection

Parâmetros

sectionPath
String

O caminho da seção a ser retornada.

Retornos

O objeto ConfigurationSection.

Exemplos

O exemplo a seguir obtém a <moduleProviders> seção e exibe o nome de cada elemento na seção.

public void GetGetSection(ServerManager manager)
{
    Configuration config = manager.GetAdministrationConfiguration();
    ConfigurationSection configSection = config.GetSection("moduleProviders");
    ConfigurationElementCollection elementCollection =
        configSection.GetCollection();
    Console.WriteLine("There are " + elementCollection.Count.ToString() +
        " elements in the section.");
    foreach (ConfigurationElement element in elementCollection)
    {
        Console.WriteLine("\t {0}", element.Attributes["name"].Value);
    }
}

Comentários

As configurações estão contidas em seções que agrupam configurações semelhantes para conveniência. A GetSection(String) sobrecarga recupera uma seção de configuração usando seu caminho.

Aplica-se a

GetSection(String, String)

Retorna a seção de configuração usando a seção especificada e os caminhos de localização.

public:
 Microsoft::Web::Administration::ConfigurationSection ^ GetSection(System::String ^ sectionPath, System::String ^ locationPath);
public Microsoft.Web.Administration.ConfigurationSection GetSection (string sectionPath, string locationPath);
member this.GetSection : string * string -> Microsoft.Web.Administration.ConfigurationSection
Public Function GetSection (sectionPath As String, locationPath As String) As ConfigurationSection

Parâmetros

sectionPath
String

O caminho da seção a ser retornada.

locationPath
String

O local para pesquisar a seção.

Retornos

O objeto ConfigurationSection.

Comentários

A GetSection(String, String) sobrecarga procura a seção de configuração em um local especificado.

Aplica-se a

GetSection(String, Type)

Retorna uma seção de configuração fortemente tipada usando o caminho de seção especificado.

public:
 Microsoft::Web::Administration::ConfigurationSection ^ GetSection(System::String ^ sectionPath, Type ^ type);
public Microsoft.Web.Administration.ConfigurationSection GetSection (string sectionPath, Type type);
member this.GetSection : string * Type -> Microsoft.Web.Administration.ConfigurationSection

Parâmetros

sectionPath
String

O caminho da seção a ser retornada.

type
Type

O tipo .NET Framework que representa a seção .

Retornos

O objeto ConfigurationSection.

Comentários

A GetSection(String, Type) sobrecarga retorna uma seção de configuração fortemente tipada no caminho da seção especificado.

Aplica-se a

GetSection(String, Type, String)

Retorna uma seção de configuração fortemente tipada usando a seção especificada e os caminhos de localização.

public:
 Microsoft::Web::Administration::ConfigurationSection ^ GetSection(System::String ^ sectionPath, Type ^ type, System::String ^ locationPath);
public Microsoft.Web.Administration.ConfigurationSection GetSection (string sectionPath, Type type, string locationPath);
member this.GetSection : string * Type * string -> Microsoft.Web.Administration.ConfigurationSection

Parâmetros

sectionPath
String

O caminho da seção a ser retornada.

type
Type

O tipo .NET Framework que representa a seção

locationPath
String

O local para pesquisar a seção.

Retornos

O objeto ConfigurationSection.

Comentários

A GetSection(String, Type, String) sobrecarga retorna uma seção de configuração fortemente tipada no local especificado e no caminho da seção.

Aplica-se a