jeudi 27 septembre 2018

Which design pattern to use to replace if condition in the c# code

Need to remove the if statement for the new instances , kindly suggest which design pattern to use. No case statement please

public ITrialBalance GetTrialBalanceReport(string param1, int param2) {

        if (param2 == 1)
            return new TrialBalanceReport().GetTrialBalanceLevel2(param1, param2);
        else
            return new TrialBalanceReport().GetTrialBalanceLevel2(param1, param2);
    }

Thanks

Aucun commentaire:

Enregistrer un commentaire