Back to Devexpress

Break Apart/Line Up Parameters/

coderushforroslyn-117234-code-style-assistance-code-formatters-break-apart-line-up-parameters-arguments.md

latest2.6 KB
Original Source

Break Apart/Line Up Parameters/

  • Aug 03, 2020
  • 2 minutes to read

Purpose

This Code Formatter is used to collapse the method parameters or arguments into a single line or break them apart.

Availability

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

Usage

Break Apart Parameters/Arguments

Follow the following steps to break the method parameters or arguments apart:

  1. Place the caret anywhere on a method parameter in the method declaration or method argument in its call.

  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.

  3. 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.

csharp
public CommandRegistration(IServiceProvider serviceProvider,
                           Guid packageGuid, 
                           Guid cmdGroup) {
    this.serviceProvider = serviceProvider;
    this.packageGuid = packageGuid;
    this.cmdGroup = cmdGroup;
}
vb
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.

Line Up Parameters/Arguments

Follow the following steps to collapse the method parameters or arguments into a single line:

  1. Place the caret anywhere on a method parameter in the method declaration or method argument in its call.

  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.

  3. 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.

csharp
public void MergeStrings() {
            TestMethod("First Name", "FamilyName", 25);
}
vb
Public Sub MergeStrings()
            TestMethod("First Name", "FamilyName", 25)
End Sub