Overriding ToString() Makes Debugging Easier(bangequals.net)

submitted by OmarKoohejiOmarKooheji(135) 3 years, 5 months ago

Make your life easier while debugging in Visual Studio, see your objects in thier full glory using ToString.

1 comment |category: |Views: 409

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by hexyhexy(325) 3 years, 4 months ago 0

While this might sound interesting and useful for debugging, there are better ways to go about this (as comments after the article explain). Especially so, when it's not appropriate to provide an arbitrary ToString method with debug mumbojumbo.

Try the Sustem.Diagnostics.DebuggerDisplayAttribute instead.

e.g.
[DebuggerDisplay("Name: {Name} ID: {ID}")]
public class MyClass {...

Reply

information Login or create an account to comment on this story