I get strange results checking the return value from a function. This code is inside the for loop:
DialogResult result = EvalReturnFromWS(returnMsg);
switch (result)
{
case DialogResult.Yes:
case DialogResult.No:
continue;
default:
break;
}
Here is a snippet from the function being called (in my unit testing, I always press the yes button):
DialogResult result = MessageBox.Show(mbText.ToString(), caption, button, icon);
switch (result)
{
case DialogResult.Yes:
return DialogResult.Yes;
case DialogResult.No:
return DialogResult.No;
case DialogResult.Cancel:
return DialogResult.Cancel;
}
When I click “Yes”, it returns DialogResult.Yes, but back in the calling code, executing the thread in the second case, which is “no”, and this continues, which I DO NOT intend.
Elsewhere in StackOverflow, I saw a stream offering to encode a "failure", for example, for DialogResult. Yes, it can fail.
In short, if YES, I want to resume execution with the next operation after the end (s) of the switch. That is, "fails."
- . , for. ( MessageBox.Show).