Archive

Archive for the ‘Code Generation’ Category

CodeRush Templates option page

October 2nd, 2012 Comments off

The Templates option page is required to control your collection of built-in and custom CodeRush code templates. When you open the Templates option page, CodeRush will locate the last template you used by default. This is an excellent way to explore and learn how templates are built. When a template expands, if you want to see how it is built, just bring up the Template options page and the last template expanded will be displayed. Here is what it looks like:

Read more…

Importing and Exporting CodeRush code templates

October 2nd, 2012 Comments off

In case you want to share your custom code templates with others, you can easily export them. As recommended, custom templates should be stored in a separate folder. You can export the entire folder. Simply right-click the folder you wish to export on the Templates option page and select the corresponding item:

Read more…

Resolving code template conflicts

September 30th, 2012 Comments off

Sometimes, you may find unexpected code template expansions when you typing code. This may happen when the template expansion key is bound to the Space Bar. Because this is a key used very often and there are tens of thousands of code templates; a complex contexts system, something may go wrong, especially if you prefer one or two key identifier names which may correspond to existing template abbreviations.

Read more…

MVC-specific CodeRush code declaration providers

September 21st, 2012 Comments off

There are three code generation providers specific to MVC. They allow you to declare MVC controllers, MVC actions and MVC views correspondingly:

  • Declare Controller
  • Declare Action
  • Declare View

Read more…

Declaring events and event handlers using CodeRush

September 21st, 2012 Comments off

With the help of CodeRush we can declare everything starting from undeclared local variables and members to undeclared objects like classes and structures. Here, we will take a look at the code declaration providers for declaring events and event handlers:

  • Declare Event
  • Declare Event Handler

Read more…

Declaring methods and constructors using CodeRush

September 21st, 2012 Comments off

When writing a new code, it usually implies writing a not-declared code like a method invocation, property calls, etc. To help you quickly create the required declarations, there are a lot of code generation providers for declaring methods, properties, fields, locals and everything else. Let’s review the method and constructor code declaration providers:

  • Declare Constructor
  • Declare Method
  • Declare Method (abstract)

Read more…

Code providers for converting unimplemented properties

August 30th, 2012 Comments off

CodeRush has two code providers that allow you to convert unimplemented properties into a property with backing store field or into an auto-implemented property quickly:

  • Convert to Property with Backing Store
  • Convert to Auto-implemented Property

Read more…

Implementing the IDisposable pattern using CodeRush

August 15th, 2012 4 comments

The IDisposable Pattern is used to release and close unmanaged resources such as files, streams, and handles as well as references to managed objects that use unmanaged resources, held by an instance of the class. For classes that require a resource cleanup, we recommended following the IDisposable pattern, which provides a standard and unambiguous pattern. The pattern has been designed to ensure reliable, predictable cleanup, and to prevent temporary resource leaks.

Read more…