I have a method which calls other method based on input parameter using switch statement as shown below:
switch (reportName)
{
case A:
return GenerateReportA(reportName, model, language);
case B:
return GenerateReportB(reportName, model, language);
case C:
return GenerateReportC(reportName, model, language);
case D:
return GenerateReportD(reportName, model, language);
case E:
return GenerateReportE(reportName, model, language);
and so on...
}
I know this switch statement will keep on increasing as more and more reports are added to system. Is there an alternate way to achieve this? ...Delegate? ...Lambda? All I know is all my GenerateReport methods will have same signature.