[英]How to set variable to Properties.Settings.Default instead of setting name?
For example I do save to App.config like this:例如,我确实像这样保存到 App.config:
int SaveInteger = %ANY INTEGER%
Properties.Settings.Default.X_Position = SaveInteger;
Properties.Settings.Default.Save();
I make a string variable that contains the name of the setting, depending on the work of the program:根据程序的工作,我制作了一个包含设置名称的字符串变量:
string Some_Setting = %ANY SETTING NAME%;
So the main question is how i can set variable Some_Setting to Properties.Settings.Default.%SettingName% instead of setting name?所以主要问题是我如何将变量 Some_Setting 设置为 Properties.Settings.Default.%SettingName% 而不是设置名称?
The base class has the Item[String]
Property.基数 class 具有Item[String]
属性。
That means you can do这意味着你可以做
Properties.Settings.Default["settingName"] = whateverValue;
For reference: ApplicationSettingsBase.Item[String] Property供参考: ApplicationSettingsBase.Item[String] 属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.