<sectionGroup> 項目
定義組態區段的命名空間。
<configuration>
<configSections>
<sectionGroup>
<sectionGroup
name="section group name"/></sectionGroup>
必要屬性
屬性 | 說明 |
---|---|
name | 指定您所要定義的區段群組名稱。 |
子項目
項目 | 說明 |
---|---|
<section> | 包含組態區段宣告。 |
備註
宣告區段群組會為組態區段建立容器 (Container) 標記,而且確保不會與其他人所定義的組態區段發生命名衝突。您可以使 <sectionGroup> 項目彼此形成巢狀結構。
範例
下列範例顯示如何宣告區段群組,以及在區段群組內宣告區段。
<configuration>
<configSections>
<sectionGroup name="mySectionGroup">
<section name="mySection"
type="System.Configuration.NameValueSectionHandler,System" />
</sectionGroup>
</configSections>
<mySectionGroup>
<mySection>
<add key="key1" value="value1" />
</mySection>
</mySectionGroup>
</configuration>
組態檔
這個項目可以在不是位於應用程式目錄層級的應用程式組態檔、電腦組態檔 (Machine.config) 和 Web.config 檔案中使用。
請參閱
NameValueSectionHandler 和 DictionarySectionHandler 的自訂項目 | SingleTagSectionHandler 的自訂項目 | 組態區段設定 | 組態區段結構描述