Reorder Parameters

Purpose

This Refactoring is used to change the method parameter order and automatically update all method references. Use it when you need to standardize the method signature or make the parameters order more logical.

Availability

Available when the caret is on a method parameter in the method declaration or call.

Usage

  1. Place the caret on a method parameter.

    Note

    The blinking cursor shows the caret's position at which the Refactoring is available.

    static Tuple<double, double> Undistort(Tuple<int, int> point, double k1, double k2, double k3, double p1, double p2) {
        // ...
        return Tuple.Create((double)point.Item1, (double)point.Item2);
    }
    static void Main(string[] args) {
        // ...
        Undistort(Tuple.Create(145, 21), -0.460891, 1.95183, -4.16323, -0.000516346, 0.00354672);
    }
    
  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Reorder Parameters from the menu.

After execution, the graphical reordering interface turns on. It allows you to move the selected parameter across the method signature using the "<— (Left Arrow)" and "—> (Right Arrow)" keys. Press Enter to confirm the new parameter location.

Refactoring_ReorderParameters

After you finish the graphical reordering, the code fill be updated according to the desired method signature.

static Tuple<double, double> Undistort(Tuple<int, int> point, double k1, double k2, double p1, double p2, double k3) {
    // ...
    return Tuple.Create((double)point.Item1, (double)point.Item2);
}
static void Main(string[] args) {
    // ...
    Undistort(Tuple.Create(145, 21), -0.460891, 1.95183, -0.000516346, 0.00354672, -4.16323);
}