How to: Reorder Parameters
You can change the order of parameters for methods, indexers, constructors, and delegates, and you can automatically update their call sites by using the Reorder Parameters refactoring operation.
To reorder parameters
Create a class library and set it up as described in the example section later in this topic.
For more information, see Class Library Template.
Place the cursor on MethodB, either in the method declaration or the method call.
On the Refactor menu, click Reorder Parameters.
The Reorder Parameters Dialog Box appears.
In the Reorder Parameters dialog box, select int i in the Parameters list, and then click the down button.
Alternatively, you can drag int i after bool b in the Parameters list.
In the Reorder Parameters dialog box, click OK.
If the Preview reference changes option is selected in the Reorder Parameters dialog box, the Preview Changes - Reorder Parameters dialog box will appear. It provides a preview of the changes in the parameter list for MethodB in both the signature and the method call.
If the Preview Changes - Reorder Parameters dialog box appears, click Apply.
In this example, the method declaration and all the method call sites for MethodB are updated.
Example
To set up this example, create a class library named ReorderParameters, and then replace Class1 with the following code.
class ProtoClassA
{
// Invoke on 'MethodB'.
public void MethodB(int i, bool b) { }
}
class ProtoClassC
{
void D()
{
ProtoClassA MyClassA = new ProtoClassA();
// Invoke on 'MethodB'.
MyClassA.MethodB(0, false);
}
}