:
// set up state for first attempt
if(!HelperMethod(false)) {
// set up state for second attempt
HelperMethod(true);
// no need to try catch since you're just throwing anyway
}
HelperMethod
bool HelperMethod(bool throwOnFailure)
, (.. false true ). :
// could wrap in try/catch
HelperMethod(2, stateChanger);
HelperMethod -
void HelperMethod(int numberOfTries, StateChanger[] stateChanger)
numberOfTries , StateChanger[] - , (.. stateChanger[0] , stateChanger[1] ..)
, . , , , ( ), (HelperMethod). SRP .
, catch , ( Exception!), throw throw e, , ..