Share via


How to: Remove Parameters

Use this procedure to perform the Remove Parameters refactoring operation. For more information, see Remove Parameters.

To remove parameters

  1. Create a console application, and set up the following example.

    For more information, see Creating Console Applications (Visual C#).

  2. Place the cursor on method A, either in the method declaration or the method call.

  3. From the Refactor menu, select Remove Parameters to display the Remove Parameters Dialog Box.

    You can also type the keyboard shortcut CTRL+R, V to display the Remove Parameters dialog box.

    You can also right-click the cursor, point to Refactor, and then click Remove Parameters to display the Remove Parameters dialog box.

  4. Using the Parameters field, position the cursor on int i, and then click Remove.

  5. Click OK.

  6. In the Preview Changes — Remove Parameters dialog box, click Apply.

Example

To set up this example, create a console application named RemoveParameters, and then replace Program with the following code. For more information, see Creating Console Applications (Visual C#).

    class A
    {
        // Invoke on 'A'.
        public A(string s, int i) { }
    }

    class B
    {
        void C()
        {
            // Invoke on 'A'.
            A a = new A("a", 2);
        }
    }

See Also

Concepts

Refactoring

Reference

Remove Parameters