coderushforroslyn-117234-code-style-assistance-code-formatters-break-apart-line-up-parameters-arguments.md
This Code Formatter is used to collapse the method parameters or arguments into a single line or break them apart.
Available when the caret is on a method parameter in the method declaration or method argument in its call.
Follow the following steps to break the method parameters or arguments apart:
Place the caret anywhere on a method parameter in the method declaration or method argument in its call.
Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
Select Break Apart Parameters ( Break Apart Arguments ) from the menu.
After execution, the Code Formatter removes the line breaks and expands the method parameters to a multiple-line form.
public CommandRegistration(IServiceProvider serviceProvider,
Guid packageGuid,
Guid cmdGroup) {
this.serviceProvider = serviceProvider;
this.packageGuid = packageGuid;
this.cmdGroup = cmdGroup;
}
Public Sub New(ByVal serviceProvider As IServiceProvider,
ByVal packageGuid As Guid,
ByVal cmdGroup As Guid)
Me.serviceProvider = serviceProvider
Me.packageGuid = packageGuid
Me.cmdGroup = cmdGroup
End Sub
Note
You can configure the indentation of broken apart parameters and arguments in the Editor | <Language> | Code Actions | Break Apart Settings options page.
Follow the following steps to collapse the method parameters or arguments into a single line:
Place the caret anywhere on a method parameter in the method declaration or method argument in its call.
Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
Select Line Up Parameters or Line Up Arguments.
After execution, the Code Formatter removes the line breaks and converts the method parameters into a single-line form.
public void MergeStrings() {
TestMethod("First Name", "FamilyName", 25);
}
Public Sub MergeStrings()
TestMethod("First Name", "FamilyName", 25)
End Sub