Postfix Templates
This page of ReSharper options lets you configure postfix templates.
Use tabs to switch between postfix templates in specific languages and use check-boxes to enable or disable templates. Note that the same templates in different languages should be enabled/disabled individually.
On the bottom of the page, you can find the following configuration options:
Item | Description |
---|---|
Code completion | |
Show postfix templates | Clear this check box if you want to disable postfix templates in the auto-completion lists. |
Show source templates | Clear this check box if you want to disable source templates in the auto-completion lists. |
Other options | |
Put braces after statement templates | If this check box is selected, ReSharper adds braces after statement templates. For example, ReSharper will add braces after the template if(myBool)
{
} |
Search for occurrences in .var template | If this check box is selected, ReSharper checks whether the expression, which you are introducing a variable for, has more occurrences in the current scope. If multiple occurrences, ReSharper can help you replace all of them with usages of the newly introduced variable: |
Invoke parameter info from templates |
List of postfix templates
Shortcut | Description | Example |
---|---|---|
.arg | Surrounds expression with invocation | |
.await | Awaits expressions of 'Task' type | |
.cast | Surrounds expression with cast | |
.else | Checks boolean expression to be 'false' | |
.field | Introduces field for expression | |
.for | Iterates over collection with index | |
.foreach | Iterates over enumerable collection | |
.forr | Iterates over collection in reverse with index | |
.if | Checks boolean expression to be 'true' | |
.lock | Surrounds expression with lock block | |
.new | Produces instantiation expression for type | |
.not | Negates boolean expression | |
.notnull | Checks expression to be not-null | |
.null | Checks expression to be null | |
.par | Parenthesizes current expression | |
.parse | Parses string as value of some type | |
.prop | Introduces property for expression | |
.return | Returns expression from current function | |
.sel | Selects expression in editor | |
.switch | Produces switch statement | |
.throw | Throws expression of 'Exception' type | |
.to | Assigns current expression to some variable | |
.tryparse | Parses string as value of some type | |
.typeof | Wraps type usage with typeof() expression | |
.using | Wraps resource with using statement | |
.var | Introduces variable for expression | |
.while | Iterating while boolean statement is 'true' | |
.yield | Yields value from iterator method | |
Shortcut | Description | Example |
---|---|---|
.else | Checks boolean expression to be 'false' | |
.forof | Iterates over an iterable object | |
.if | Checks boolean expression to be 'true' | |
.notnull | Checks expression to be not-null | |
.notundefined | Checks expression to be not-undefined | |
.null | Checks expression to be null | |
.return | Returns expression from current function | |
.undefined | Checks expression to be undefined | |
.var | Introduces variable for expression | |
Shortcut | Description | Example |
---|---|---|
.else | Checks boolean expression to be 'false' | |
.forof | Iterates over an iterable object | |
.if | Checks boolean expression to be 'true' | |
.instanceof | Checks instance of expression | |
.notnull | Checks expression to be not-null | |
.notundefined | Checks expression to be not-undefined | |
.null | Checks expression to be null | |
.return | Returns expression from current function | |
.typeof | Checks type of expression | |
.undefined | Checks expression to be undefined | |
.var | Introduces variable for expression | |
Shortcut | Description | Example |
---|---|---|
.beg..end | Produces iterators from range | |
.cbeg..cend | Produces iterators from range | |
.const_cast | Surrounds expression with const_cast | |
.do | Iterating until boolean expression becomes 'false' | |
.dynamic_cast | Surrounds expression with dynamic_cast | |
.else | Checks boolean expression to be 'false' | |
.foreach | Iterates over range | |
.if | Checks boolean expression to be 'true' | |
.make_shared | Constructs an object and wraps it in a std::shared_ptr | |
.make_unique | Constructs an object and wraps it in a std::unique_ptr | |
.new | Produces instantiation expression for type | |
.reinterpret_cast | Surrounds expression with reinterpret_cast | |
.return | Returns expression from current function | |
.static_cast | Surrounds expression with static_cast | |
.switch | Produces switch over integral/enum type | |
.var | Introduces variable for expression | |
.while | Iterating while boolean expression is 'true' | |