Duplicate Line
- 2 minutes to read
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.
#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.