【发布时间】:2012-06-13 02:58:07
【问题描述】:
我想知道如何在运行时在 C sharp 中添加新的用户设置。如何动态插入新值?提前致谢
【问题讨论】:
标签: c# .net visual-studio-2010 settings
我想知道如何在运行时在 C sharp 中添加新的用户设置。如何动态插入新值?提前致谢
【问题讨论】:
标签: c# .net visual-studio-2010 settings
设置可以代表用户偏好或有价值的信息 应用程序需要使用。
添加新设置:
Properties.Settings.Default.Properties.Add("property_name",Color.AliceBlue);
Properties.Settings.Default.Save();
编辑现有设置:
Properties.Settings.Default["property_name"]=Color.Green;
Properties.Settings.Default.Save();
检索
Color backColor = Properties.Settings.Default["property_name"] as Color;
删除现有设置:
Properties.Settings.Default.Properties.Remove("property_name");
Properties.Settings.Default.Save();
【讨论】: