Predefined Surround Templates for C#
This topic lists all predefined surround templates for C# in JetBrains Rider 2017.3. For more information about surround templates, see Surrounding Code Fragments with Templates
Template | Details |
---|---|
() | Surround the selection with parentheses Scope C++ expressions, C# 2.0+ Body ($SELECTION$$END$) Parameters
Before expansion |
{} | Surround the selection with braces Scope C++ statements, C# 2.0+ Body {
$SELECTION$$END$
} Parameters
Before expansion |
foreach | foreach block Scope C# 2.0+ statements Body foreach ($TYPE$ $VARIABLE$ in $COLLECTION$)
{
$SELECTION$$END$
} Parameters
|
for | Simple "for" loop Scope C# 2.0+ statements Body for (int $INDEX$ = 0; $INDEX$ < $UPPER$; $INDEX$++)
{
$SELECTION$$END$
} Parameters
Before expansion |
#if (Imported Visual C# Snippets) | Scope C# 2.0+ except strings Body #if $expression$
$SELECTION$$END$
#endif Parameters
|
#region (Imported Visual C# Snippets) | Surround the selection with a region Scope C# 2.0+ except strings Body #region $name$
$SELECTION$$END$
#endregion Parameters
Before expansion |
namespace (Imported Visual C# Snippets) | Add a namespace to the selected code Scope C# 2.0+ types and namespaces Body namespace $name$
{
$END$$SELECTION$
} Parameters
Before expansion |
tryf (Imported Visual C# Snippets) | try finally Scope C# 2.0+ statements Body try
{
$SELECTION$
}
finally
{
$END$
} Parameters
|
try (Imported Visual C# Snippets) | try catch Scope C# 2.0+ statements Body try
{
$SELECTION$
}
catch ($EXCEPTION$ $EX_NAME$)
{
$SELSTART$System.Console.WriteLine($EX_NAME$);
throw;$SELEND$
} Parameters
|
while (Imported Visual C# Snippets) | while loop Scope C# 2.0+ statements Body while ($expression$)
{
$SELECTION$$END$
} Parameters
Before expansion |
do (Imported Visual C# Snippets) | do...while loop Scope C# 2.0+ statements Body do
{
$SELECTION$$END$
} while ($expression$); Parameters
|
if (Imported Visual C# Snippets) | if statement Scope C# 2.0+ statements Body if ($expression$)
{
$SELECTION$$END$
} Parameters
Before expansion |
lock (Imported Visual C# Snippets) | lock statement Scope C# 2.0+ statements Body lock ($expression$)
{
$SELECTION$$END$
} Parameters
Before expansion |
using (Imported Visual C# Snippets) | using statement Scope C# 2.0+ statements Body using($resource$)
{
$SELECTION$$END$
} Parameters
Before expansion |
cast | Cast the selection to a specific type Scope C# 2.0+ expressions Body (($TYPE$)$SELECTION$) Parameters
Before expansion |