The requested page is not available for the requested platform. You are viewing the content for Default platform.

Reorder Parameters

  • 2 min to read

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.

Note

The Reorder Parameters refactoring is not available for methods declared in the third party assembly.

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.

Reorder

After execution, the graphical reordering interface turns on. Use the "<— (Left Arrow)" and "—> (Right Arrow)" keys to move the selected parameter across the method signature. 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);
}