Tip: ToString() for your custom Class


While writing code and then debugging with step by step debugger you often just roll over a variable to see what it contain. With custom class it shows the class name/namespace path by default. And it makes debugging harder. A simple solution to this is to add a override to the ToString function in your class that expose required item, this will later be used by debugger to show when you hover over the variable. it is particularly helpful when we debug for IEnumerable items.

, , ,