你好潜在的读者
我想知道是否可以在调试时在运行时看到settingsobjet的存储值。就像你将鼠标悬停在它们之上时看到变量的价值一样。我知道我可以随时做出:
字符串a = Properties.Settings.Default。(myObjectName)并将鼠标悬停在a上,但我想知道是否有更快的方法。我已经尝试了Google,但它并没有真正向我展示任何可以回答我问题的内容:(
(我正在使用visualstudios 2015和.Net Framework 4.5.2)。
Properties.Settings.Default.FileLocation = ProfileListBox.OpenFile;
//problem: I use the Filelocation quite often in my code but have to always backtrack to see what the currently assigned value for Filelocation is.
如果您知道另一种查看Filelocationvalue的方法(在我的情况下),如果您能说出来,那将非常适合。
答案 0 :(得分:0)
我的这种方法可以帮助您解决问题:
只需处理设置的PropertyChanged
事件。
void test() {
Settings.Default.PropertyChanged += Default_PropertyChanged;
}
private void Default_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "MyProperty")
{
var tValue = Settings.Default.PropertyValues[e.PropertyName].PropertyValue.ToString();
toolStripStatusLabelMessage.Text = String.Format("Property {0} changed to {1} ", e.PropertyName , tValue);
}
}