If you are writing a function for doing something and this function needs a lot of input(Parameters), so should I make a structure, class or whatever… to pass those parameters or not?
In other words, what’s the recommended count of parameters that we should not exceed and use structure or object from class instead?
For readability you should indeed create a parameter object – it is a well known refactoring.
This is something you see in several places in the BCL itself – the
Processclass can take aProcessStartInfoparameter object.Some people think that 7 should be the most number of parameters, others say 3. You need to agree with your team on this. If working alone, look at increasing readability.