如何更改app.config文件设置 我的app.com是
<configuration>
<configSections>
<sectionGroup name="applicationSettings" />
<section name="Chat.Properties.Settings"/>
</sectionGroup>
</configSections>
<applicationSettings>
<Chat.Properties.Settings>
<setting name="Chat_WebReference_WebService1" serializeAs="String">
<value>http://localhost/logs/abc.asmx</value>
</setting>
</Chat.Properties.Settings>
</applicationSettings>
</configuration>
我想要编辑值 的 HTTP://localhost/logs/abc.asmx
答案 0 :(得分:3)
如果设置正确,您应该可以使用Properties.Settings.Default
:
Properties.Settings.Default.Chat_WebReference_WebService1 = "new value";
如果您想要保留回文件,请不要忘记保存:
Properties.Settings.Default.Save();
修改必须将设置置于userSettings
下,否则上述操作会引发错误。
<userSettings>
<Chat.Properties.Settings>
<setting name="Chat_WebReference_WebService1" serializeAs="String">
<value>http://localhost/logs/abc.asmx</value>
</setting>
</Chat.Properties.Settings>
</userSettings>