【发布时间】:2015-08-11 06:11:51
【问题描述】:
我正在尝试在 app.config 中为我的 Windows 应用程序保存一些配置。 我在 Google 中搜索了解决方案,但没有与此相关的任何内容。我的要求是我想使用我的 Windows 应用程序保存/更新 app.config 中的配置。
我的架构将是这样的:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="customAppSettings1" type="System.Configuration.NameValueSectionHandler"/>
<section name="customAppSettings2" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<customAppSettings1>
<add key="FirstKey" value="1" />
<add key="SecondKey" value="2" />
</customAppSettings1>
<customAppSettings2>
<add key="FirstKey" value="1" />
<add key="SecondKey" value="2" />
</customAppSettings2>
</configuration>
【问题讨论】:
-
什么?它只是 XML。
-
是的,我知道如何读取元素但不知道如何更新元素的值。
-
以上解决方案用于更新 appSettings。我要求自定义配置部分。
标签: c# app-config