I want the following code to execute when the myString is having either of these values A, B, C or D. Right now I know that I have these 4 values but in near future I can have more values in this set.
My Code:
var result = MyBlRepository.MyBLMethod(myString);
The simple way to have n number of if else loops but it can grow when I have more values. What is the best way to handle this? Which design pattern should be best for it?
EDIT: I don’t want to keep the filters here. I don’t want want to modify the code of this file.
You need the Strategy pattern, as explained here
It allows you to handle multiple if statements nicely. There is a short and easy tutorial showing how to handle multiple if statements in the above link.
Hope this helps.