Template scopes
JetBrains Rider defines a number of scopes where a code template can be available. Scopes help you limit usage of a particular code template to the relevant context.
For example, the predefined live template itar (iterate an array) is available by default in C# 2.0+ statements. It means that this particular scope is defined for this template; you can apply the itar template in the body of a C# statement, but you cannot apply it in the body of a C# class outside of any members or, say, in an XML file.
You can assign several scopes to each template. All template's scopes are shown in the Availability field on the template settings page:
![JetBrains Rider: Template scopes JetBrains Rider: Template scopes](https://resources.jetbrains.com.cn/help/img/rider/2024.2/template_scopes_1.png)
You can edit template scopes in a dialog that opens by clicking the Availability button. For detailed instructions, follow the Create a live/surround template procedure.
The scopes for live templates and surround templates are defined by file type and allowed location. The scopes for file templates are defined by project type.