Share via


Configuration.GetSection メソッド

定義

構成セクションを返します。

オーバーロード

GetSection(String)

指定したセクション パスを使用して、構成セクションを返します。

GetSection(String, String)

指定したセクションと場所のパスを使用して、構成セクションを返します。

GetSection(String, Type)

指定したセクション パスを使用して、厳密に型指定された構成セクションを返します。

GetSection(String, Type, String)

指定したセクションと場所のパスを使用して、厳密に型指定された構成セクションを返します。

GetSection(String)

指定したセクション パスを使用して、構成セクションを返します。

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

パラメーター

sectionPath
String

返されるセクションのパス。

戻り値

ConfigurationSection オブジェクト。

次の例では、 セクションを <moduleProviders> 取得し、セクション内の各要素の名前を表示します。

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

注釈

構成設定は、便宜上同様の設定をグループ化するセクションに含まれています。 オーバーロードは GetSection(String) 、そのパスを使用して構成セクションを取得します。

適用対象

GetSection(String, String)

指定したセクションと場所のパスを使用して、構成セクションを返します。

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

パラメーター

sectionPath
String

返されるセクションのパス。

locationPath
String

セクションを検索する場所。

戻り値

ConfigurationSection オブジェクト。

注釈

オーバーロードは GetSection(String, String) 、指定した場所にある構成セクションを検索します。

適用対象

GetSection(String, Type)

指定したセクション パスを使用して、厳密に型指定された構成セクションを返します。

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

パラメーター

sectionPath
String

返されるセクションのパス。

type
Type

セクションを表す.NET Framework型。

戻り値

ConfigurationSection オブジェクト。

注釈

オーバーロードは GetSection(String, Type) 、指定したセクション パスの厳密に型指定された構成セクションを返します。

適用対象

GetSection(String, Type, String)

指定したセクションと場所のパスを使用して、厳密に型指定された構成セクションを返します。

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

パラメーター

sectionPath
String

返されるセクションのパス。

type
Type

セクションを表す.NET Framework型

locationPath
String

セクションを検索する場所。

戻り値

ConfigurationSection オブジェクト。

注釈

オーバーロードは GetSection(String, Type, String) 、指定した場所とセクション パスに厳密に型指定された構成セクションを返します。

適用対象