Break Apart Parameters

Places each parameter on a separate line.

Purpose

If a method's parameter list is getting long, you might want to increase code readability by splitting the parameter list, so each parameter is declared on a separate line. In these cases, this refactoring will save you some formatting work by automatically placing each parameter onto its own line, while keeping proper spacing and indents.

Availability

Available from the context menu or via shortcuts:

  • when the edit cursor, or caret is on a method with at least three parameters.

Notes

Example

private string TestMethod(string p1, string p2, string p3)
{
    return String.Format("{0}, {1}, {2}", p1, p2, p3);
}
Private Function TestMethod(ByVal p1 As String, ByVal p2 As String, ByVal p3 As String) As String
    Return String.Format("{0}, {1}, {2}", p1, p2, p3)
End Function

Result:

private string TestMethod(string p1, 
    string p2, 
    string p3)
{
    return String.Format("{0}, {1}, {2}", p1, p2, p3);
}
Private Function TestMethod(ByVal p1 As String, _
    ByVal p2 As String, _
    ByVal p3 As String) As String
    Return String.Format("{0}, {1}, {2}", p1, p2, p3)
End Function

Animation

rsBreakApartParameters

See Also