It's a two-for-one day today that, despite the title, doesn't actually have to do much with ones. Or twos for that matter. No, it's more a case of redundancy in redundant cases. Oy, I'm gonna stop narrating after that one ... here's the first sample from Tristan Harmer
switch (state) { case Enumerations.PageState.Edit: //Load Page Data LoadPageData(); break; case Enumerations.PageState.Update: //Load Page Data LoadPageData(); break; case Enumerations.PageState.Add: //Load Page Data LoadPageData(); break; default: //Load Page Data LoadPageData(); }
And then there's Andrea Nagy's code, that really begs the question, if an if's branches branch the same, then why else, or or, or even if really needed? Ouch, that was bad; you should feel seriously lucky that it's not a "smorgasbord" post ...
If Request.Form("ml") = "Y" Then lblNavigation.Text = _
ddlOperationList.Items.Item(ddlOperationList.SelectedIndex).Text Else lblNavigation.Text = _
ddlOperationList.Items.Item(ddlOperationList.SelectedIndex).Text End If
