When should I use Debug.Assert()?

I’ve been a professional software engineer for about a year now, having graduated with a CS degree. I’ve known about assertions for a while in C++ and C, but had no idea they existed in C# and .NET at all until recently. Our production code contains no asserts whatsoever and my question is this… Should … Read more

What’s the purpose of using braces (i.e. {}) for a single-line if or loop?

I’m reading some lecture notes of my C++ lecturer and he wrote the following: Use Indentation // OK Never rely on operator precedence – Always use parentheses // OK Always use a { } block – even for a single line // not OK, why ??? Const object on left side of comparison // OK … Read more