This page describes templates for .NET languages. Web-specific templates, which work in HTML, JavaScript, TypeScript, and so on are described in Web-specific templates.
JetBrains Rider enables you to create classes, interfaces, structs and other files based on file templates. Once created, a new file is added to your project and opens in the editor. The file contains source code specified in the template.
note
File templates use indentation and formatting defined by language-specific code style settings that you can configure on the Editor | Code Style | [Language] page of JetBrains Rider settings
Create a new file from template
Do one of the following:
In the Solution Explorer, select a node where you want to create a new file from template.
Place the caret at a code file open in the editor. In this case, the new file will be created and placed next to the current file.
Press .
Choose Class, Interface, Struct, and so on, or a custom item (if available) in the quick access list.
In the Create: [name of template] dialog that appears, specify the name for the new file and click OK.
The newly created file is added to the selected place and opens in the editor
.
If the template has editable parameters (that is, requires user input), JetBrains Rider deploys a hot spot session in the editor and sets the input position at the first parameter. Then you can do the following:
If JetBrains Rider suggests some values for the current parameter, use Up and Down arrow keys to navigate through the list of suggested values, or just type in a desired value.
Press Tab or Enter to accept the value and move to the input position of the next parameter. If this is the last parameter, the hot spot session completes and the caret moves to the end position defined for the session.
Press Shift+Tab to move the input focus to the input position of the previous parameter.
Press Esc to exit the hot spot session. In this case, all session parameters will be initialized with default values.
tip
To get the most out of templates, you can edit the existing templates or create new templates so that the set of your templates will best fit your development practices.