JetBrains Rider
 
Get JetBrains Rider
Get your hands on the new features ahead of the release by joining the Early Access Program for Rider 2025.1! Learn more

Declare template variables

Last modified: 11 February 2024

Code templates can adjust to the surrounding context or even act interactively when you apply them. All this is done with template variables and template macros.

You can define and edit template variables on the template settings pages, when a specific template is selected. As soon as you type a variable (prefixed and suffixed with $), it becomes available in the Edit variables dialog . You can then configure its behavior by clicking Change macro:

JetBrains Rider: Template editor

You can use any variable in a template more than once; their values will be synchronized when the template applies.