How to shorten the Long Parameter List in a Clean and Proper Way

Error processing SSI file


  1. Otto

    • 2018/5/25

    You can do it with params-array:

    public static class ButtonProperties
        public static void _ButtonProperties(params Button[] buttons)
            foreach (Button b in buttons)
                b.FlatStyle = FlatStyle.Flat;
                b.FlatAppearance.BorderSize = 0;

    Now you can pass a single button, multiple(comma separated) or even a Button[].

    As an example:

    ButtonProperties._ButtonProperties(btn_dashboard, btn_products);
  2. Kayson

    • 2016/7/17

    You can do it with params -array: public static class ButtonProperties { public static void _ButtonProperties(params Button[] buttons) 

  3. Ben

    • 2018/9/4

    c# - How to shorten the Long Parameter List in a Clean and Proper Way - Stack Overflow. So here's my codepublic static class ButtonProperties{ public static void _ButtonProperties(Button btn_dashboard, Button btn_products, Button btn_supplier, Button btn_customer, Button btn_sa Stack Overflow.

  4. Solomon

    • 2021/9/7

    More than three or four parameters for a method. Reasons for the Problem. A long list of parameters might happen after several types of algorithms are merged in 

  5. Colson

    • 2016/1/3

    seeing as you're doing the same thing to each button, why not just pass a list?

    public static void _ButtonProperties(List<Button> buttons)
        foreach (var button in buttons)
             button.FlatAppearance.BorderSize = 0;
             button.FlatStyle = FlatStyle.Flat;
  6. Jaxton

    • 2017/4/4

    Parameter list java. How to Use Methods that Take Parameters in Java, Note: A method can have variable length parameters with other only one varargs parameter that should be written last in the parameter list of The number of arguments can be found out using a.length, the way we find the length of an array in Java.

  7. Thompson

    • 2016/5/19

    Treatment · To reduce the length of a method body, use Extract Method. · If local variables and parameters interfere with extracting a method, use Replace Temp 

  8. Jesse

    • 2018/11/28

    The steps are: Create a method to access the field (and unit tests) Replace every occurence of the parameter in the method with a call to the method. Delete the parameter from the method signature. Remove redundant code in calling methods.

  9. Joaquin

    • 2018/6/13

    Instead of having a fixed brunch of param, You can have a List.

    public static void SetButtonProperties(List<Button> buttons){
        foreach(var button in buttons){
            button.FlatStyle = FlatStyle.Flat;
            button.FlatAppearance.BorderSize = 0;

    Calling it like :

     SetButtonProperties(new List<Button>{ btn_dashboard, btn_products, btn_supplier, ... })
  10. Finley

    • 2018/11/24

    c) When there is validation code involved, the constructor method body can become quite big & complex with high cyclomatic complexity. You'll often see clumps 

  11. Casen

    • 2015/4/26

    10 How to shorten the Long Parameter List in a Clean and Proper Way Sep 18 '18. 4 What algorithm to use to calculate a check digit? Feb 17 '15.

  12. Wesley

    • 2018/2/1

    One way is to extract the arguments into a new class, A long parameter list doesn't worry me at all - as long as it is properly 

  13. Korbin

    • 2020/8/2

    4 Filling a list with values in a range Oct 25 '19 3 How to shorten the Long Parameter List in a Clean and Proper Way Sep 18 '18 View all questions and answers →

  14. Kohen

    • 2019/3/18

    Don't mistake good advice for a mandate. Lots of parameters is generally a code smell that you've got too much going on in one function/method. People used to 

  15. Solomon

    • 2020/6/5

    Note: Once you’ve taken sufficient time to create data-rich URLs, I recommended that you shorten them, using tools like or Google Link Shortener. A long and bulky URL does not make for a good user experience and might even come across as spammy. Also, the UTM parameters are visible to the users in their address bars.

  16. Price

    • 2019/11/14

    shortened, the most effective of which involves proper electrode The following list summarizes the factors that are important for obtaining a clean 

  17. Tucker

    • 2019/4/29

    TABLE 4.2.4 (continued) (k) check all terminals and electrical connections (1) if oil bath air cleaner is used, clean and fill with correct grade of oil (m) 

  18. Martin

    • 2016/3/5

    Long parameter list in a method call is a code smell. It is hard to use a method call or to get the parameters in correct order.

  19. Kelmendi

    • 2016/12/14

    To make the Lookup() function generic, two parameters must be passed when it is invoked: the you could add code to list the possible correct entries.

Comments are closed.

More Posts