|
1金钱
我用苏飞大大发布的confighelper类和我百度搜索的类:class ConfigHelper
{
public static string fileName = System.IO.Path.GetFileName(Application.ExecutablePath);
public static bool AddSettings(string key,string value)
{
Configuration cfg = System.Configuration.ConfigurationManager.OpenExeConfiguration(fileName);
cfg.AppSettings.Settings.Add(key, value);
cfg.Save();
return true;
}
public static string GetSettings(string key)
{
Configuration cfg = System.Configuration.ConfigurationManager.OpenExeConfiguration(fileName);
string value=cfg.AppSettings.Settings[key].Value;
return value;
}
public static bool UpdateSettinds(string key,string newValue)
{
Configuration cfg = System.Configuration.ConfigurationManager.OpenExeConfiguration(fileName);
cfg.AppSettings.Settings[key].Value = newValue;
return true;
}
}
===================================================================================
都出现了只能读取,不能添加和修改的问题,好心大侠帮帮忙呢。
|
|