JetBrains Rider 2024.1 Help

Predefined File Templates for C#

This topic lists all predefined file templates for C# in JetBrains Rider 2024.1. For more information about file templates, refer to Create files from templates.

Template

Details

Class

Create a new file containing an empty C# Class in the current project.

Scope C# projects

Body

$HEADER$namespace $NAMESPACE$ { public class $CLASS$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • CLASS - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

Interface

Create a new file containing an empty C# Interface in the current project.

Scope C# projects

Body

$HEADER$namespace $NAMESPACE$ { public interface $INTERFACE$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • INTERFACE - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

Struct

Create a new file containing an empty C# Struct in the current project.

Scope C# projects

Body

$HEADER$namespace $NAMESPACE$ { public struct $STRUCT$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • STRUCT - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

Enum

Create a new file in the current project containing an empty C# Enum.

Scope C# projects

Body

$HEADER$namespace $NAMESPACE$ { public enum $ENUM$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • ENUM - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

Record

Scope C# projects

Body

$HEADER$namespace $NAMESPACE$ { public record $RECORD$($END$); }

Parameters

  • HEADER - Inserts the file header specified in settings

  • RECORD - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

MSTest Test Class

MSTest Test Class

Scope C# projects, MSTest Test Project

Body

$HEADER$namespace $NAMESPACE$ { [Microsoft.VisualStudio.TestTools.UnitTesting.TestClass] public class $CLASS$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • CLASS - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

NUnit 3x Test Fixture

NUnit 3x Test Fixture

Scope C# projects, NUnit 3x Test Project

Body

$HEADER$namespace $NAMESPACE$ { [NUnit.Framework.TestFixture] public class $CLASS$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • CLASS - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

NUnit 2x Test Fixture

NUnit 2x Test Fixture

Scope C# projects, NUnit 2x Test Project

Body

$HEADER$namespace $NAMESPACE$ { [NUnit.Framework.TestFixture] public class $CLASS$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • CLASS - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

xUnit Test Class

xUnit Test Class

Scope C# projects, xUnit Test Project

Body

$HEADER$namespace $NAMESPACE$ { public class $CLASS$ {$END$} }

Parameters

  • HEADER - Inserts the file header specified in settings

  • CLASS - Evaluates to the current file name without extension and with all non-alphanumeric characters replaced with underscores

  • NAMESPACE - Evaluates to the default namespace for the current file

  • END - The caret position after the template is applied.

Razor MVC Partial View

Razor MVC Partial View

Scope Razor (C#) projects, Razor (C#) Views folder

Body

@model $model$ $END$

Parameters

  • model - Guesses the type expected at this point

  • END - The caret position after the template is applied.

Razor MVC View

Razor MVC View

Scope Razor (C#) projects, Razor (C#) Views folder

Body

@model $model$ @{ Layout = null; } <!DOCTYPE html> <html> <head> <title>$title$</title> </head> <body> <div> $END$ </div> </body> </html>

Parameters

  • model - Guesses the type expected at this point

  • title - no macro

  • END - The caret position after the template is applied.

Razor MVC View with Layout

Razor MVC View with Layout

Scope Razor (C#) projects, Razor (C#) Views folder

Body

@model $model$ @{ ViewBag.Title = "$title$"; Layout = "$_Layout$"; } <h2>$title$</h2> $END$

Parameters

  • model - Guesses the type expected at this point

  • title - no macro

  • _Layout - Shows smart code completion list at the point where the variable is evaluated

  • END - The caret position after the template is applied.

Last modified: 11 April 2024