<configuration> 的 <configSections> 元素

包含組態區段和命名空間宣告。

<configuration>
  <configSections>

屬性

父元素

描述
<configuration> 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。

子元素

描述
<section> 包含組態區段宣告。
<sectionGroup> 定義組態區段的命名空間。

備註

若此元素位於組態檔,則必須為 <configuration> 元素的第一個子元素。

範例

下列範例示範如何定義組態區段,並定義該區段的設定:

<configuration>
  <configSections>
    <section name="sampleSection"
             type="System.Configuration.SingleTagSectionHandler" />
  </configSections>
  <sampleSection setting1="Value1"
                 setting2="value two"
                 setting3="third value" />
</configuration>

組態檔

應用程式組態檔、電腦組態檔 (Machine.config) 與不在應用程式目錄層級的 Web.config 檔案中,皆可使用此元素。

另請參閱