samedi 31 janvier 2015

Avoiding a large amount of overloads


I'm currently writing a mailing interface for our enterprise application. Dependent on the send mode (regular email, bulk email, templates, mailmerge, ...) our Send() method requires a bunch of parameters.


Now we have got this Send() method that offers to take around 20 parameters, with nearly 10 overloads and default values.


Now of course you could use the C# 4.0 feature of named parameters like described here, but even that would be a mess when mostly 10 of 15 overloaded parameters have to be used.


Is there some better practice?





Aucun commentaire:

Enregistrer un commentaire