[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)

Promote to Parameter

Expanded Purpose

Converts a local variable to the method parameter. Use this Code Provider inside a method to generalize it. Having a new parameter on a method will increase its flexibility for consumers.

Note

Promote to 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 caret is on a local variable name within the variable declaration statement.

Expanded Usage

  1. Place the caret on the name of a local variable in its declaration.

    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 Promote to Parameter from the menu.

After execution, the Code Provider removes the variable initialization, adds the new method parameter named after the variable and adds its initial value to each method call.

In the example above, the EURToUSD function has been generalized and can be renamed to ConvertToUSD.

Expanded See Also

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