简体   繁体   English

在Visual Studio调试器值“{}”中它意味着什么?

[英]What does it mean in Visual Studio debugger value “{ }”?

I have in my Visual Studio 2008 .NET C# project one property observed and debugger shows open and immediately closed curly brackets "{}". 我在我的Visual Studio 2008 .NET C#项目中观察到一个属性,调试器显示打开并立即关闭大括号“{}”。 I believe it is uninitialized (I)List, but why it does not shows "null" or "unitialized". 我相信它是未初始化的(I)List,但为什么它不显示“null”或“unitialized”。 What does "{}" it means ? 这是什么意思 ?

br, Milan. br,米兰。

The most likely reason is that the type of the value in question overrides the .ToString() method and returns an empty string. 最可能的原因是所讨论的值的类型会覆盖.ToString()方法并返回空字符串。 This will cause the display to be {} as the C# EE wraps the return of .ToString inside of {}'s 这将导致显示为{},因为C#EE包含了{}内部.ToString的返回

If you want to change the value shown in the debugger you can control it with the DebuggerDisplayAttribute . 如果要更改调试器中显示的值,可以使用DebuggerDisplayAttribute控制它。 You could also override the .ToString() method instead. 您也可以改写.ToString()方法。 But this could affect other areas of your applications. 但这可能会影响您应用程序的其他区域。

This can indicate a value of System.DBNull 这可以指示System.DBNull的值

You can check against it like this: 您可以像这样检查它:

                    foreach (var val in datarow.ItemArray)
                    {
                        if (val == DBNull.Value)
                        {
                            var item = val;
                        }
                    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio 2015中,{enum} .value_是什么意思? - in visual studio 2015 what does {enum}.value_ mean? Visual Studio“任何 CPU”目标是什么意思? - What does the Visual Studio "Any CPU" target mean? 文件显示在Visual Studio的解决方案资源管理器中,带有快捷方式图标。那是什么意思? - Files show up in Solution Explorer in Visual Studio with a shortcut icon. What does that mean? 在 Visual Studio 中,“包含在项目中”和“从项目中排除”到底是什么意思? - What exactly does 'Include In Project' and 'Exclude From Project' mean in Visual Studio? 是什么原因导致Visual Studio调试器使某些问题无法重现? - What causes the Visual Studio Debugger to make some issues not reproducible? 如何在Visual Studio 2008调试器中查看GUID的值? - How do I see the value of a GUID in the Visual Studio 2008 debugger? Visual Studio - 如何在调试器中更改方法的返回值? - Visual Studio - How to change the return value of a method in the debugger? Visual Studio 2022 调试器 IISExpress - Visual Studio 2022 Debugger IISExpress Visual Studio 2008调试器分离 - Visual Studio 2008 debugger detach 标签目标接收值意味着什么? - What does it mean for a label target to receive a value?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM