Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example where [DebuggerDisplay(...)] attribute is useful?

I am looking for a good concrete example where it is clearly desirable to override ToString() with something, but to use a [DebuggerDisplay(...)] custom attribute to display something else in the debugger?

like image 805
Timwi Avatar asked Jul 15 '26 00:07

Timwi


1 Answers

Say, for example, a Node object for a binary tree.

The ToString() would merely want to display the payload for that node, while the DebuggerDisplay would probably also show which nodes it was pointing to.

like image 147
James Curran Avatar answered Jul 17 '26 13:07

James Curran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!