Postfix Templates for Visual StudioDownload this extension from the Visual Studio Marketplace or get the latest CI build from Open VSIX Gallery. Stop writing boilerplate. Type what you mean, then let the template finish the thought.
Postfix Templates adds 40+ code completion shortcuts for C#. Type an expression, press How it works
For example, typing
Templates are context-aware - they only appear when applicable to the expression type. Boolean templates show up for boolean expressions, enumerable templates for collections, and so on. Templates
ConfigurationEach template can be individually enabled or disabled from Tools -> Options -> Postfix Templates -> General. Turn off the ones you don't need to keep the completion list focused.
Custom TemplatesYou can define your own postfix templates by placing a File format
Each template object supports these properties:
Expression types for
|
| Value | Shows when |
|---|---|
any |
Any expression (default) |
boolean |
Boolean expressions |
string |
String expressions |
nullable |
Nullable or reference types |
enumerable |
Collections and arrays |
exception |
Exception types |
disposable |
IDisposable types |
awaitable |
Task and awaitable types |
referenceType |
Reference types |
Example
A .postfix.json for an ASP.NET Core project might look like:
{
"$schema": "https://raw.githubusercontent.com/madskristensen/PostfixTemplates/refs/heads/master/postfix-template-schema.json",
"templates": [
{
"name": "log",
"description": "Log with ILogger",
"body": "_logger.LogInformation({expr})",
"suffix": "logging"
},
{
"name": "ok",
"description": "Wrap in Ok result",
"body": "Ok({expr})",
"suffix": "action result"
},
{
"name": "tolist",
"description": "Convert to List",
"body": "{expr}.ToList()",
"suffix": "LINQ",
"appliesTo": "enumerable"
}
]
}
Templates are automatically reloaded when the file changes. Add the $schema property to get IntelliSense and validation while editing the file.
Contribute
Check out the issue tracker for ideas, bugs, and feature requests. Pull requests are welcome.

