what's the best practice to refactor the following c# code: Can replace this with Strategy pattern?
private int GetAccountType(int balance)
{
if (balance <= 5000)
{
return 1;
}
else if (balance > 5000 && balance <= 10000)
{
return 2;
}
else if (balance >= 10001)
{
return 3;
}
_logger.LogError("Invalid AccountType");
// TO DO : Throw custom exception
throw new Exception("Invalid Balance");
}
Aucun commentaire:
Enregistrer un commentaire