jeudi 11 janvier 2018

Create a Condition class

I cannot be the first person to think of this but here we go. I am tired of the slow and painful process of rifling through If statements. My project has a datatable that requires me to check a series of scenarios but using the IF statement is making it slow and cumbersome.

So, I want to create a class nominated as a Condition. my condition class will loop through a series of statements and check if each is true or false and return a Boolean at the end as a result. Here is my idea. I make a List(of Cond). An example might be 1 > 0. But I want to keep being able to add these to the list.

Then I want to send that list over to the Condition class and evaluate it using a Select. Here is where I seek the advice and or assistance of my peers. How? How can I turn a string into a statement?

I want to turn this CondList.add("1 > 0") into

Select Case condlist(x) Case True : etc etc Case False : something else End Select

Does anyone have any input on how something like this could be achieved and even some feedback on whether this would ultimately speed up the filtering process? I would appreciate a good discussion on this as it has been nagging me for some time.

Aucun commentaire:

Enregistrer un commentaire