vendredi 23 décembre 2016

C# - Pattern for iterating over predicates

I made a pattern which i dont really like.

It is as the following:

result = findResult(getFirstPriorityElements(listOfPossibleResults));
if (result!= null)
{
 return result;
}

result = findResult(getSecondPriorityElements(listOfPossibleResults));
if (result!= null)
{
 return result;
}

etc..

Basically i'am creating sublists based on a couple of rules. After creating the sublist, i try and find a specific element in it. If i dont find, i move on to the next priority, and so on.

I would like a solution where i can iterate over these criterias, until i find a solution. But i dont know how to get them to a format which i can iterate over.

Aucun commentaire:

Enregistrer un commentaire