ReSharper

Code Templates

Click a button to display features available in specific edition.



      Live Templates

      Live Templates are ReSharper's far more intelligent version of Visual Studio's code snippets. As with code snippets, you need to type a template abbreviation, press Tab to expand the template, and then use Enter or Tab to navigate through template variables. Unlike code snippets, ReSharper can predict from the context which variables, fields, and types can be used in corresponding templates. In most cases you donít need to type anything yourself. Just choose from a list of suggested values.

      Abbreviation for "foreach" live template

      "foreach" live template expanded

      Abbreviation for "foreach" live template

      "foreach" live template expanded

      to the top

      "Surround With" Templates

      "Surround With" Templates is similar to Live Templates and is used to quickly enclose an expression, a single statement, or an arbitrary block of code with if/else, try/catch or other code constructs. ReSharper intelligently reformats the code, adjusts the selection, and/or repositions the caret as specified by the template.

      To surround a piece of code, select it and press Ctrl + Alt + J.

      "if" Surround With template

      Code block after using "if"

      "if" Surround With template

      Code block after using "if"

      to the top

      File Templates

      ReSharper lets you add new files to your project with predefined code fragments already generated in them. For example, you can create a new file with a class declaration, an interface, struct declaration, and so on. To use a file template, right-click on a project or folder in Visual Studio's Solution Explorer, browse to Add, New from Template, select a template and enter the name of the new file to insert in your project.

      to the top

      Customizing, Configuring and Sharing Templates

      Create your own templates and modify predefined ones. Templates can be configured via the ReSharper Options dialog.

      Once defined, any template can be easily shared among team members in two ways.

      Shared Solution Templates folder

      You and your team members can use this folder to store shared templates designed for use with any particular solution. Templates placed in the folder will be accessible to anyone who opens the current solution.

      Mounted File Storage

      Templates can also be shared among a group of developers via Mounted File Storage. First, team members mount file storage, where the file contains templates designed for common use by the team and is stored in shared network location. Templates contained in the mounted file are updated from and to the file whenever the solution is opened or closed. Any changes made to the file are automatically made available to all other developers.

      to the top


          Live Templates

          Live Templates are ReSharper's far more intelligent version of Visual Studio's code snippets. As with code snippets, you need to type a template abbreviation, press Tab to expand the template, and then use Enter or Tab to navigate through template variables. Unlike code snippets, ReSharper can predict from the context which variables, fields, and types can be used in corresponding templates. In most cases you donít need to type anything yourself. Just choose from a list of suggested values.


          Abbreviation for "foreach" live template


          "foreach" live template expanded

          to the top

          "Surround With" Templates

          "Surround With" Templates is similar to Live Templates and is used to quickly enclose an expression, a single statement, or an arbitrary block of code with if/else, try/catch or other code constructs. ReSharper intelligently reformats the code, adjusts the selection, and/or repositions the caret as specified by the template.

          To surround a piece of code, select it and press Ctrl + Alt + J.


          "if" Surround With template


          Code block after using "if"

          to the top

          File Templates

          ReSharper lets you add new files to your project with predefined code fragments already generated in them. For example, you can create a new file with a class declaration, an interface, struct declaration, and so on. To use a file template, right-click on a project or folder in Visual Studio's Solution Explorer, browse to Add, New from Template, select a template and enter the name of the new file to insert in your project.

          to the top

          Customizing, Configuring and Sharing Templates

          Create your own templates and modify predefined ones. Templates can be configured via the ReSharper Options dialog.

          Once defined, any template can be easily shared among team members in two ways.

          Shared Solution Templates folder

          You and your team members can use this folder to store shared templates designed for use with any particular solution. Templates placed in the folder will be accessible to anyone who opens the current solution.

          Mounted File Storage

          Templates can also be shared among a group of developers via Mounted File Storage. First, team members mount file storage, where the file contains templates designed for common use by the team and is stored in shared network location. Templates contained in the mounted file are updated from and to the file whenever the solution is opened or closed. Any changes made to the file are automatically made available to all other developers.

          to the top


              Live Templates

              Live Templates are ReSharper's far more intelligent version of Visual Studio's code snippets. As with code snippets, you need to type a template abbreviation, press Tab to expand the template, and then use Enter or Tab to navigate through template variables. Unlike code snippets, ReSharper can predict from the context which variables, fields, and types can be used in corresponding templates. In most cases you donít need to type anything yourself. Just choose from a list of suggested values.


              Abbreviation for "foreach" live template


              "foreach" live template expanded

              to the top

              "Surround With" Templates

              "Surround With" Templates is similar to Live Templates and is used to quickly enclose an expression, a single statement, or an arbitrary block of code with if/else, try/catch or other code constructs. ReSharper intelligently reformats the code, adjusts the selection, and/or repositions the caret as specified by the template.

              To surround a piece of code, select it and press Ctrl + Alt + J.


              "if" Surround With template


              Code block after using "if"

              to the top

              File Templates

              ReSharper lets you add new files to your project with predefined code fragments already generated in them. For example, you can create a new file with a class declaration, an interface, struct declaration, and so on. To use a file template, right-click on a project or folder in Visual Studio's Solution Explorer, browse to Add, New from Template, select a template and enter the name of the new file to insert in your project.

              to the top

              Customizing, Configuring and Sharing Templates

              Create your own templates and modify predefined ones. Templates can be configured via the ReSharper Options dialog.

              Once defined, any template can be easily shared among team members in two ways.

              Shared Solution Templates folder

              You and your team members can use this folder to store shared templates designed for use with any particular solution. Templates placed in the folder will be accessible to anyone who opens the current solution.

              Mounted File Storage

              Templates can also be shared among a group of developers via Mounted File Storage. First, team members mount file storage, where the file contains templates designed for common use by the team and is stored in shared network location. Templates contained in the mounted file are updated from and to the file whenever the solution is opened or closed. Any changes made to the file are automatically made available to all other developers.

              to the top