ReSharper | Templates Explorer | Surround Templates | C#
This topic lists all predefined surround templates for C# in ReSharper 2022.1. For more information about surround templates, see Surround code fragments with templates
Template
Details
()
Surround the selection with parentheses
Scope C# 2.0+, C++ expressions
Body
($SELECTION$$END$)
Parameters
SELECTION - The text selected by the user before invoking the template.
END - The caret position after the template is applied.
Before expansionAfter expansion
{}
Surround the selection with braces
Scope C# 2.0+, C++ statements
Body
{
$SELECTION$$END$
}
Parameters
SELECTION - The text selected by the user before invoking the template.
END - The caret position after the template is applied.
Before expansionAfter expansion
foreach
foreach block
Scope C# 2.0+ statements
Body
foreach ($TYPE$ $VARIABLE$ in $COLLECTION$)
{
$SELECTION$$END$
}
Parameters
COLLECTION - Show basic code completion list at the point where the variable is evaluated (complete)
TYPE - Suggest type for a new variable declared in the template (suggestVariableType)
VARIABLE - When executed in variable declaration (where variable name should stand), suggests name for the variable. (suggestVariableName)
SELECTION - The text selected by the user before invoking the template.
END - The caret position after the template is applied.