[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
[Expand]CodeRush
[Collapse]CodeRush Classic
  What's New
 [Expand]System Requirements
 [Collapse]Concepts
  [Expand]Code Analysis
  [Expand]Code Style
   Feature Advisor
   FrictionFree Mode
   Mastering CodeRush Classic Features
  [Expand]Visualization Tools
  [Expand]Navigation
  [Expand]Advanced Selection Tools
  [Expand]Clipboard Tools
  [Collapse]Coding Assistance
   [Expand]Code Providers
   [Expand]Code Templates
   [Expand]Refactorings
    AutoDeclare
    Automatic Declaration
    Comment/Uncomment
    Cycle Scope Up/Down
    Duplicate Line
    Embedding
    Intellassist
    IntelliRush
    Inversions
    Smart Constructor
    Smart Enter
    Smart Parens and Brackets
    Smart Paste
   Unit Test Runner
 [Expand]Visual Elements
 [Expand]Tool Windows
 [Expand]CodeRush Classic Options
 [Expand]Examples
  Get More Help
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Duplicate Line

The Duplicate line tool is useful when you need to create similar lines in the code. For instance, you are going to declare a number of string fields. You can declare each field manually, but that will take too much time. The other method is to create a single declaration, and duplicate it with Duplicate Line. Place the cursor on the line to be duplicated, and press SHIFT+ENTER. CodeRush Classic will duplicate the line and select the field name in the new line.

Expanded Available Duplications

Duplication Description
Field Duplicates the declaration.
Initialized Field Duplicates an initialized field declaration (bringing the initialization to the new line).
Initialized Integer Field Duplicates integer fields initialized to an integer value. The initialized value is incremented by one for the duplicated line.
Event Duplicates event declarations.
Method (Interface) Duplicates method declarations when inside an interface.
Property (Interface) Duplicates property declarations when inside an interface.
Using Duplicates using statements.
if (aa is bb) Matches if-expressions checking to see if object ooo is of type ttt. Declares a new local variable of type ttt, initialized to ooo (typecast as ttt).
Assignment Statement Duplicates an assignment statement.
Flagged Enum Element Duplicates an initialized element of an enumeration, doubling the initialized value on the next line.

You can customize existing Duplicate Line templates and create new ones in the Duplicate Line page of CodeRush Classic Options.

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