1.在vs中设计要存储的字段,如:zbl,注意范围选择用户
读取:
var aa = Properties.Settings.Default.zbl;
写入:
Properties.Settings.Default.zbl = "dfafdafdas";
保存:
Properties.Settings.Default.Save();
保存位置:
win7系统
C:\Documents and Settings\Administrator\AppData\Local\Application Data\ComponentCopyProtection\ComponentCopyProtection.v_Url_d45ohcntzmqcq5j2rsrni1qnp0k22kwe\1.0.0.0\user.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <userSettings> <ComponentCopyProtection.Properties.Settings> <setting name="zbl" serializeAs="String"> <value>dfafdafdas</value> </setting> </ComponentCopyProtection.Properties.Settings> </userSettings> </configuration>
默认Documents and Settings拒绝访问,
授权方法参考:http://blog.sina.com.cn/s/blog_76980a410100qjnn.html
目录解析参考:http://blog.csdn.net/netcoder/article/details/3265846