Я обычно это делаю.
Код: Выделить всё
public void MethodA()
{
if( MethodB())
{
return;
}
//do what MethodA purpose.
}
public bool MethodB()
{
//conditition that should stop execution in Method A
}
Код: Выделить всё
public void MethodA()
{
//MethodB would stop MethodA without the need for if condition
MethodB()
//do what MethodA purpose.
}
public bool MethodB()
{
//conditition that should stop execution in Method A
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... in-c-sharp
Мобильная версия