[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Collapse]CodeRush
  System Requirements
  Improve Performance
 [Expand]Features by Language
 [Expand]Getting Started
 [Expand]How To
 [Collapse]Coding Assistance
  [Expand]Code Templates
  [Expand]Auto Completion
  [Expand]Clipboard Tools
  [Expand]Selection Tools
  [Collapse]Code Providers
   [Expand]Contract Providers
   [Expand]Declaration Providers
   [Expand]Implementation Providers
    Add Copyright Header
    Add Else Statement
    Add Getter/Setter
    Add Missing Constructors
    Add Parameter
    Add to Interface
    Add XML Comments
    Convert to Function
    Convert to Procedure
    Convert to Property With Change Notification/Introduce Change Notification
    Create Event Trigger
    Encapsulate Property
    Import Type/All Types (XAML)
    Initialize
    Introduce Format Item
    Introduce Setter Guard Clause
    Invert Selection
    Promote to Parameter
    XPO Fields
  [Expand]Declare Menu
  [Expand]Typing Helpers
 [Expand]Navigation and Search Tools
 [Expand]Static Code Analysis
 [Expand]Visualization Tools
 [Expand]Code Style Assistance
  Building Assistance
  Debugging Assistance
 [Expand]Refactoring Assistance
 [Expand]Unit Testing Assistance
 [Expand]Decompiling Tools
 [Expand]Configuration Options
 [Expand]Extensibility
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Add Parameter

Expanded Purpose

Adds a new parameter to a method signature and update all method references.

Note

Add Parameter is a cascading Code Provider. That means that the Code Provider affects all method calls and method declarations in interfaces, base and descendant classes.

Expanded Availability

Available when the cursor is in a method signature or in the arguments list in the method reference.

Expanded Usage

  1. Place the caret in a method signature.

    Note

    The blinking cursor shows the caret's position at which the Code Provider is available.

  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Add Parameter from the menu.
  4. Specify the type of new parameter and press Enter.
  5. For the base method and all overridden implementations, specify the parameter name. Use the Enter key to switch between method overrides.
  6. For each method reference, specify what is passed to the method as a newly added parameter. Use the Enter key to switch between method usages.

After execution, the Code Provider adds a new method parameter and updates all method usages.

Note

Being called from the method arguments list, this Code Provider determines the parameter type automatically, according to the passed argument type.

Expanded Adding Parameters Passed by Reference

You can also specify the out or ref keyword if the parameter should be passed onto a method by reference. Consider the code snippet below.

Follow the instructions from the Usage section to add a new parameter and specify the "ref int" string as a new parameter's type (add ByRef in VB). If the out or ref keyword was specified, CodeRush passes the corresponding variable on method usages and declares/initializes it if required.

Is this topic helpful?​​​​​​​