If you are trying to write your code "functional path", you may find "Currying" useful and create meaningful objects-objects that are initialized only with pairs of parameters. If a function takes many parameters, their list can (or should) usually be divided into meaningful fragments, and curry should form a chain of functions with meaningful intent.
So instead (an example of this answer):
run(x, y, max_x, true, false, dx * 2, range_start, range_end, 0.01, true);
you can use
// initialize functors run_in_userbox = run(x, y, max_x); run_with_bounds = run_in_userbox(true, false); iterate_within_bounds = run_with_bounds(dx * 2, range_start, range_end, 0.01); result = iterate(true); //computation only starts here
I don't know if this supports C #, but as usual the problem is solved in functional languages.
source share