c# 在运行时在 Debug模式下显示设置值

标签 c# visual-studio settings

潜在读者您好

我想知道是否可以在调试运行时看到设置对象的存储值。就像您将鼠标悬停在变量上方时如何看到变量的值一样。我知道我总是可以这样做:

string a = Properties.Settings.Default.(myObjectName) 并将鼠标悬停在 a 上,但我想知道是否有更快的方法。我已经尝试过 Google,但它并没有真正向我展示任何可以回答我的问题的内容:(

image of the settings

(我正在使用 Visualstudio 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. 

如果您知道查看文件位置值的其他方法(就我而言),如果您能告诉我,我们将非常感激。

最佳答案

我认为这种方法可以帮助您解决问题:

只需处理设置的 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);
            }
        }

关于c# 在运行时在 Debug模式下显示设置值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34046350/

相关文章:

c# - Application Insights 无法在本地运行的 Azure Worker Function 中工作

c# - MSBuild 未生成发布网页 (ClickOnce)

c# - 没有 Response.End() 代码无法正常工作

c++ - 如何在 visual studio 中保存默认启动项目

java - maven "cannot find symbol"消息无用

swift - 如何从设置菜单返回应用程序? ( swift iOS 10)

c# - DataTables MVC 回发数据为空

c++ - 如何使用 natvis Visual Studio C++ 调试器可视化工具对单一类型进行多个列表扩展

c++ - 使用 Visual Studio 2008 从 x86 编译 x64 dll : unresolved external __imp_ symbols

Android 融合位置提供商设置