It does what now?
-
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
} -
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
}:doh: Well, it is completely redundant, and why is it Nullable? I guess the developer had a case of hypocaffenia and encountered a '404: Brain Not Found' error.
Bob Dole
The internet is a great way to get on the net.
:doh: 2.0.82.7292 SP6a
-
:doh: Well, it is completely redundant, and why is it Nullable? I guess the developer had a case of hypocaffenia and encountered a '404: Brain Not Found' error.
Bob Dole
The internet is a great way to get on the net.
:doh: 2.0.82.7292 SP6a
Zac Greve wrote:
hypocaffenia
Love it! :cool:
-
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
}It's entirely possible that they would pass null into toggleSwitch. Of course, it should be HasValue rather than Value.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
}It's not redundant at all. But it probably doesn't function the way the author intended. What the author probably had in mind was:
private void toggleSwitch(bool? visible = false)
{
toggleState(visible);
}...which wraps a non-nullable toggle function with a nullable one. But as it is written, the functionality that this method offers is actually: 1. If user passes toggleSwitch(True), then toggleState is toggled. BUT, 2. If user passes toggleSwitch(False) or toggleSwitch(), then NOTHING happens (because of the test).
-
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
}Congrats. You have successfully installed bugs! :)
-
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
} -
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
}It throws an exception when
visible == null
.