The Best Code is No Code At All

I’m all for simplicity and maintainability.

if (s == String.Empty)
if (s == “”)

But like the first comment says (GuyNamedNate), String.Empty just seems like the right thing to use even though “” is easier to type.

if (false == flag)
if (!flag)

Its interesting but as the years have gone by I’ve revert from (!flag) to (flag == false). Using (!flag) is again easier but explicitly showing (flag == false) just makes for more readable code, that little ! could so easily be missed whilst flicking through someone else’s code.

I know its stupid but it really annoys me when I have to make a change to code and the original developer has left out the braces, although I’m sure they were just simplifying the code:

Example: If (flag) return var;

I can’t help it but I have to add the braces in…