Resharper just prompted me on this line of code:
private static bool shouldWriteToDatabase = false;
indicating that I should not say ” = false” because bools, apparently, default to false in C#. I’ve been programming in C# for over a year and a half and never knew that. I guess it just slipped through the cracks, but this leaves me wondering what’s good practice.
Do I work on the assumption that default values are understood by all? This would result in cleaner code, but invites ambiguity if another programmer isn’t aware of the default value.
Personally I think:
However I don’t think Resharper can easily detect the difference between these two situations.