从另一个过程中退出原始函数
Exit original function from another procedure
在 C# 中是否有任何方法可以从另一个过程中退出一个函数?
示例:
void myFunction()
{
checkLogin(); //make sure a user is logged in
doOtherStuff(); //continue with other stuff
}
void checkLogin()
{
if(loggedIn==false)
{
exitOriginalFunction(); // exit myFunction
}
}
void myFunction()
{
if(!checkLogin())
return; //make sure a user is logged in
doOtherStuff(); //continue with other stuff
}
void checkLogin()
{
if(loggedIn==false)
{
return false; // exit myFunction
}
return true;
}
在 C# 中是否有任何方法可以从另一个过程中退出一个函数?
示例:
void myFunction()
{
checkLogin(); //make sure a user is logged in
doOtherStuff(); //continue with other stuff
}
void checkLogin()
{
if(loggedIn==false)
{
exitOriginalFunction(); // exit myFunction
}
}
void myFunction()
{
if(!checkLogin())
return; //make sure a user is logged in
doOtherStuff(); //continue with other stuff
}
void checkLogin()
{
if(loggedIn==false)
{
return false; // exit myFunction
}
return true;
}