<sectionGroup> <configSections 的元素>

定义配置节的命名空间。

<配置>
   <configSections>
     <sectionGroup>

Syntax

<sectionGroup name="section group name">
  <!-- Configuration sections -->
</sectionGroup>

Attribute

Description
name 必需属性。

指定要定义的节组的名称。

Parent 元素

Description
<configSections> 元素 包含配置节和命名空间声明。

子元素

Description
<部分> 包含配置节声明。

注解

声明节组会为配置节创建容器标记,并确保与其他人定义的配置节没有命名冲突。 可以相互嵌套 <sectionGroup> 元素。

Example

以下示例演示如何声明节组并在节组中声明节:

<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 文件。

另请参阅