If you have methods that really act on a large number of variables, for example, as you mentioned, you can also consider creating a class that should act as a data container. After filling in, you can pass the class to functions that require data instead of ten parameters.
I can’t recall the exact example, but in the Microsoft book, Framework Design Guide, they explicitly describe a scenario similar to yours, as well as how they followed the same approach in the .NET Framework.
In addition, if you need to pass this many parameters, take a step back and make sure that this code does not need to be refactored. There are legitimate cases where a method requires a lot of data, but I use long method signatures as a sign that I need to look inside the method to make sure that it does only what it needs.
source share