1、作用范围
在Settings.settings文件中定义配置字段,
把作用范围定义为:User则运行时可更改,Applicatiion则运行时不可更改
2、读取配置值
String str=Properties.Settings.Default.FieldName;
//FieldName是你定义的字段
3、修改和保存配置
Properties.Settings.Default.FieldName = "server";
Properties.Settings.Default.Save();//使用Save方法保存更改
注意:
当设置scope为User时他的配置放在 C:\Documents and Settings\LocalService\Local Settings\application Data\在这个目录下或子目录user.config 配置文件中。