I have the following switch statement, and when the string foo = "FOO" then the case will trigger two MessageBoxes. But I only get “Dog” popped up and not “Cat“. For some reason, the case only run the first statement then break itself. Why is that?
switch(foo)
{
case "FOO"
MessageBox.Show("Dog");
MessageBox.Show("Cat");
break;
case ...
case ...
}
Unable to reproduce. For example, run this:
Both message boxes show up. I suspect something else is going on that you’re not showing us. If you can edit your question to include a short but complete program which does demonstrate the problem, that will be a different matter.