Configuration.GetSection Méthode

Définition

Retourne la section de configuration.

Surcharges

GetSection(String)

Retourne la section de configuration à l’aide du chemin d’accès de section spécifié.

GetSection(String, String)

Retourne la section de configuration à l’aide des chemins de section et d’emplacement spécifiés.

GetSection(String, Type)

Retourne une section de configuration fortement typée à l’aide du chemin d’accès de section spécifié.

GetSection(String, Type, String)

Retourne une section de configuration fortement typée à l’aide des chemins de section et d’emplacement spécifiés.

GetSection(String)

Retourne la section de configuration à l’aide du chemin d’accès de section spécifié.

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

Paramètres

sectionPath
String

Chemin de la section à retourner.

Retours

Objet ConfigurationSection.

Exemples

L’exemple suivant obtient la <moduleProviders> section et affiche le nom de chaque élément de la section.

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

Remarques

Les paramètres de configuration sont contenus dans des sections qui regroupent des paramètres similaires pour des raisons pratiques. La GetSection(String) surcharge récupère une section de configuration à l’aide de son chemin d’accès.

S’applique à

GetSection(String, String)

Retourne la section de configuration à l’aide des chemins de section et d’emplacement spécifiés.

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

Paramètres

sectionPath
String

Chemin de la section à retourner.

locationPath
String

Emplacement de recherche de la section.

Retours

Objet ConfigurationSection.

Remarques

La GetSection(String, String) surcharge recherche la section de configuration à un emplacement spécifié.

S’applique à

GetSection(String, Type)

Retourne une section de configuration fortement typée à l’aide du chemin d’accès de section spécifié.

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

Paramètres

sectionPath
String

Chemin de la section à retourner.

type
Type

Type .NET Framework qui représente la section.

Retours

Objet ConfigurationSection.

Remarques

La GetSection(String, Type) surcharge retourne une section de configuration fortement typée dans le chemin de section spécifié.

S’applique à

GetSection(String, Type, String)

Retourne une section de configuration fortement typée à l’aide des chemins de section et d’emplacement spécifiés.

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

Paramètres

sectionPath
String

Chemin de la section à retourner.

type
Type

Type .NET Framework qui représente la section

locationPath
String

Emplacement de recherche de la section.

Retours

Objet ConfigurationSection.

Remarques

La GetSection(String, Type, String) surcharge retourne une section de configuration fortement typée dans l’emplacement et le chemin de section spécifiés.

S’applique à