Design mode
Gotcha: DesignMode property is not valid in constructor, use Load event instead.
Debugging code
To declare code that is active for a configuration only prefer using attribute against #ifdef's for more readable code: [Conditional("DEBUG")]
For displaying user string representation of classes in the debugger, prefer using the DebuggerDisplay attribute to overriding ToString as the latter is used by String.Format primarily:
[DebuggerDisplay("Count = {count}")]
class MyHashtable
{
public int count = 4;
}
Temporary File
using System.IO;
FileInfo tempFile = new FileInfo(Path.GetTempFileName());
...
tempFile.Delete();







