How to avoid “too many parameters” problem in API design?
I have this API function: public ResultEnum DoSomeAction(string a, string b, DateTime c, OtherEnum d, string e, string f, out Guid code) I don't like it. Because parameter order becomes unnecessarily significant. It becomes harder to add new fields. It's harder to see what's being passed around. It's harder to refactor method into smaller parts because it creates another overhead of passing all the parameters in sub functions. Code is harder to read. I came up with the most obvious idea: have an object encapsulating the data and pass it around instead of passing each parameter one by one. Here