[导入]<configSections> 的 <remove> 元素移除预定义的节或节组。
移除预定义的节或节组。
<configuration>
<configSections>
<remove>
<remove name="section name or section group name"/>
必选属性
| 属性 | 说明 |
|---|---|
| name | 指定要移除的节或节组的名称。 |
备注
可使用 <remove> 元素从应用程序中移除在配置文件层次结构的更高级别定义的节和节组。
示例
下面的示例说明如何在应用程序配置文件中使用 <remove> 元素移除先前在计算机配置文件中定义的节。
以下计算机配置文件代码声明 <sampleSection> 这一节。
<!-- Machine.config file. -->
<configuration>
<configSections>
<section name="sampleSection"
type="System.Configuration.SingleTagSectionHandler" />
</configSections>
<sampleSection setting1="Value1" setting2="value two"
setting3="third value" />
</configuration>
下面的应用程序配置文件代码移除 <sampleSection> 节。移除之后,应用程序将无法检索 <sampleSection> 中的设置。
<!-- Application configuration file. -->
<configuration>
<configSections>
<remove name="sampleSection"/>
</configSections>
</configuration>
配置文件
此元素可用于应用程序目录级以外的应用程序配置文件、计算机配置文件 (Machine.config) 和 Web.config 文件中
文章来源:http://www.codeguru.cn/ShowThread.aspx?PostID=730
浙公网安备 33010602011771号