共用方式為


<configSections> 項目

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

<configuration>
<configSections>

<configSections>
</configSections>

子項目

項目 說明
<section> 包含組態區段宣告。
<sectionGroup> 定義組態區段的命名空間。
<configSections> 的 <remove> 項目 移除預先定義的區段或區段群組。
<configSections> 的 <clear> 項目 清除所有先前定義的區段和區段群組。

備註

如果這個項目位於組態檔中,則它必須是 <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 檔案中使用。

請參閱

組態區段結構描述 | 組態區段設定