I have recently inherited some code that is very poorly written. Unfortunately, it is a system that we depend on highly, and there isn't time to re-write it all, so I am stuck maintaining it and re-writing pieces as I go along. However, today I stumbled on this method that contains a switch and one of the case statements has no break. How is this able to compile? It is my understanding that all cases have to break, return or goto.
private void ReadBadge_Activated(object sender, EventArgs e)
{
try
{
if (!bInHideMode)
{
// Set Button states
btnCancelSwipe.Visible = true;
btnCancelSwipe.Refresh();
// Enable the Timeout timer
//tmrTimeout.Enabled = true;
// Refresh data
switch (mManageAction)
{
case "LogOnManager":
case "NormalUse":
lblSwipeStatus.Text = "Pass ID Badge\nNear The Reader";
break;
case "AddNewUser":
lblSwipeStatus.Text = "Pass ID Badge\nNear The Reader\nFor: " + mUserName;
break;
default:
lblSwipeStatus.Text = "Pass ID Badge\nNear The Reader\nFor: " + mUserName;
break;
}
}
}
catch (Exception ex)
{
MessageBoxNoClick.MessageBox2(ex.Message, "Error Message");
}
}