Saturday, 14 September 2013

Curly braces continuity

Curly braces continuity

This question may be too vague but I need to hear some ideas.. I have an
intricate issue with my code, I was able to reduce the problem to this
situation:
public void MyMethod()
{
foreach(Obj o in ObjCollection)
{
if(Something)
{
//Do operations
}
MessageBox.Show("1");
}
MessageBox.Show("2");
}
The first message shows up. The second doesn't. How in the world that is
possible? Is there a way of this behavior or I'm missing something?
The actual code is too long for pasting it here but it works if I isolate it.

No comments:

Post a Comment