How to get ToString() to show up in Debug

前端 未结 7 1071
情话喂你
情话喂你 2020-12-15 21:34

I\'d like to get ToString() to display for a class under my control in debug mode.

It\'d be nice if this was the first thing to show up when you hover over a varia

相关标签:
7条回答
  • 2020-12-15 22:25

    The output of ToString should be the default you see when debugging.

    It can be overridden using the DebuggerDisplay Attribute (see MSDN).

    I prefer overriding the ToString method because its easier and more versatile because it helps when writing to log files as well.

    What output do you see? If you get the type name you see the default ToString.

    0 讨论(0)
提交回复
热议问题