jeudi 3 janvier 2019

binding different method to recursive calls in c#

I'm writing a control program which will iterate through a combination of multiple parameters (many many parameters, bundled into many structs). The simplest idea is just to split program into small modules and call each modules. like below

A -> B -> Loop 1: -> C -> Loop 2: -> D and so on

it worked, but make this program hard to modify and maintain. I'm thinking if I can refactory this code with dynamic loops and recursive calls. currently my idea is to, with a stack, write a recursive method but invoking different method based on which loop i am in (using interface or delegation?). Is this possible or is there a better design to adopt?

Thank you

Aucun commentaire:

Enregistrer un commentaire