ReSharper Web Help

When you apply code templates, ReSharper initializes template parameters with some values. To calculate these values, it uses template macros.

Template macros can retrieve a lot of useful data based on the surrounding context, For instance, current file name, current solution name, containing namespace, clipboard content, and so on. Even more, macros can invoke code completion actions, guess and suggest types, variables, tags, and more. For details, see the full list of template macros.

As soon as you declare a new template parameter, the parameter appears in the right part of the Template Editor along with the Choose macro hyperlink below it. Clicking this link allows you to choose a macro for the parameter.

Some macros just bring you the necessary item. E.g., Current solution name or Suggest tag name. Other macros have their own parameter, which you need to specify. For example, if you choose the Suggest variable of type macro for a template parameter, you will need to provide a type for the corresponding macro parameter. When choosing a macro in the Choose Macro dialog box, you can recognize macro parameters by the bold highlighting.

Note

Please do not confuse template parameters and macro parameters.

If you do not define any macro for a template parameter, the parameter name is inserted when you apply the template. The user will be suggested to edit this name if the parameter editable.

The best way to grasp the usage of template macros is to study the rich set of ReSharper's predefined templates.