Basically I have something like this:
public void Form1_btnStart_click()
{ 开发者_StackOverflow中文版Void1() NextLine }Public void Void1()
{ Void2() }I need to get out of Void2 or beyond and go to the "NextLine" spot. Other than putting an if statement after each subroutine to see if a certain value is met and then using "return;", which would cause some problems since this is a large program which means that this change wouldn't necessarily be corrected for every possible button that eventually uses this Void2() subroutine and could even break it under many circumstances. Any ideas?
Throw a custom exception, and wrap your call to Void1()
in a try...catch
block to catch it.
精彩评论