Write Boilerplate Code Faster
with fewer keystrokes
Code Templates are sequences of simple shortcuts that generate common boilerplate code (like classes, properties, and methods). CodeRush Templates save time and keep you focused on the essence of what you're building.
For example, use "c" to create a new class with default constructor. Or use "cc" inside an existing class to define a constructor (with parameters that initialize selected properties in the class).
Create any member instantly and easily. Start with a shortcut for the member you want to create (e.g., use "a" for auto-implemented properties, or "m" for methods), followed by a shortcut for the member type you want to create (like "s" for string, "i" for int, or "b" for bool). So “mb” creates a method that returns a boolean, and ps creates a property of type string (with backing store). These member templates expand seamlessly inside structs, records, classes, and interfaces.
Code Templates understand the surrounding code, and that includes frameworks referenced, and even the version of the language you're working with, so you get smart code that makes sense, every time.
Watch Video
Predefined Code Templates
Comprehensive template collection is built-in.
CodeRush includes a large library of predefined Code Templates for C#, Visual Basic, JavaScript, TypeScript, HTML, Razor, and XAML development, as well as powerful templates for working with DevExpress components (XAF, XPO, Blazor, etc.).
Compared to Visual Studio's code snippets, CodeRush code templates are simpler, more intelligent, and are much easier to customize or extend using a powerful code template wizard. You can also create a custom templates for any code part in C#, Visual Basic, JavaScript, TypeScript, XAML, CSS, HTML, Razor, F#, and any other language.
One Click to Declare Them All
Add Using Directives and Common Member Implementations
In a single key press, CodeRush's Import Missing Namespaces adds using directives for every type that's missing a namespace reference in the file. And CodeRush can add multiple missing namespaces all at once. Without CodeRush you'll need to add those missing namespace references one at a time.
And yes, you can quickly add often-needed implementations to your types (such as IDisposable, Equals/ToString/GetHashCode overrides, etc.) in C# and Visual Basic using the Declare Menu.
Consume-first Declaration
Create Code Elements Automatically From Usage
When coding, it is often useful to work with an identifier before it has been declared (consume-first development). This happens in test-driven development, and it's useful when creating APIs to start with consumption code (so your perspective models those of developers who will consume your API). Consume-first declaration lets you focus on desired functionality first, not the declarations.
CodeRush provides powerful tools to quickly declare missing types, members, variables, and parameters, all based on usage. If it's a member, CodeRush lets you choose where to put it (and make any changes there if needed), and helps you instantly get back to where you were so you can stay focused on the functionality.
Selection Embedding
Surround Selected Code with Popular Language Constructs
Instantly surround your selected code with a try/finally, try/catch, using statement, braces, and more. Want to put your code in region? – Just select it and press Ctrl+3.
And the engine is flexible, so if you find yourself writing the same surrounding code again and again (like a try/catch with exception logging), just create your own with the powerful selection embedding wizard. You can even bind your custom embedding to a single intelligent keystroke.
Smart Duplicate Line/Selection
Intelligently Create New Code
Based on a Sample Selection
Speed up the creation of structurally-similar code blocks, and intelligently build new code based on patterns detected in the surrounding code.
Smart Duplicate Line and Smart Duplicate Selection can make it easy to create distinct, yet structurally-similar blocks of code.
Watch Video