Very nice tips indeed!
A somewhat different approach to this might be to use the Debugger.IsAttached
Though this works somewhat different.
This looks more .NETish, but also performs differently as you can see.
I have used it many times for debugging purposes (for example, giving a value to a variable only for debugging).
Though not really a substitute for the above tips, I thought I should include this for completeness.
Started programming in 2010 after completing a Bachelor Common Art and Cultural Sciences and a Master Media and Journalism. A decision I haven't come to regret!
A company hired me and they taught me the basics of VB.NET, WinForms and SQL Server.
At the end of that year I signed up for CodeProject and that was when my programming knowledge increased rapidly. Being around some of the best and most enthausiastic coders in the world certainly helps you develop your own skills.
After a while I enrolled in some IT courses at the Open University and I also got Microsoft Certified.
I am currently working to get a Bachelor degree in IT.
At my job I am programming in VB.NET, C# and SQL Server using WinForms and DevExpress controls.
Meanwhile I am trying to educate others through my (prize-winning) articles
] here on CodeProject.