Think about it:
bool? autorefresh = Properties.Settings.Default.autorefresh;
Properties.Settings.Default.autorefresh not null, so it will be either true or false.
Therefore, a zero local autorefresh will also be either true or false, since it is initialized to a value that is either true or false.
autorefresh = (autorefresh == null) ? false : autorefresh;
Therefore, this is equivalent to:
autorefresh = autorefresh;
which is obviously pointless. (And, as others have pointed out, autorefresh ?? false is the best way to write this code anyway.)
Question: why do you have a local variable in the first place? Why not just say:
Enabled = Properties.Settings.Default.autorefresh;
?
source share