【发布时间】:2016-05-18 07:03:23
【问题描述】:
我在 Mono (Ubuntu) 上保存用户设置时遇到问题。这是代码示例:
private void Form1_Load(object sender, EventArgs e)
{
string savedText = Properties.Settings.Default.tbText.ToString();
tbInput.Text = savedText;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
string textToSave = tbInput.Text;
Properties.Settings.Default.tbText = textToSave;
Properties.Settings.Default.tbText = Properties.Settings.Default.tbText;
Properties.Settings.Default.Save();
}
但我只收到类似的空配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<userSettings />
</configuration>
我已经尝试过类似的东西
Properties.Settings.Default.tbText = Properties.Settings.Default.tbText;
来自here。但仍然得到相同的结果。如何在 Mono 中使用设置?
【问题讨论】: