C#
- #if..#endif
- #region
- ()
- {}
- cast
- do..while
- for
- if
- if..else
- namespace
- lock
- String.Format
- try..catch
- try..finally
- using
- while
ReSharper comes with a number of predefined surround templates. You can use them "as is" or customize according to your individual requirements and programming style.
Some templates are parameterized, requiring that you fill in some parameters after the template code is inserted.
Two parameters specified in preview listings are common for most templates:
- $SELECTION$ specifies the position of previously selected code within an applied template.
- $END$ denotes the position of the caret after a template is applied.
| Template name | Description |
|---|---|
|
#if..#endif
Go to top |
Purpose
#if $END$
$SELECTION$
#endif
Before expansion
Parameters
|
|
#region
Go to top |
Purpose
#region $END$
$SELECTION$
#endregion
Before expansion
Parameters
|
|
()
Go to top |
Purpose
($SELECTION$$END$)
Before expansion
Parameters
|
|
{}
Go to top |
Purpose
{
$SELECTION$$END$
}
Before expansion
Parameters
|
|
cast
Go to top |
Purpose
(($TYPE$)$SELECTION$)
Before expansion
Parameters
|
|
do..while
Go to top |
Purpose
do{$SELECTION$}while($END$);
Before expansion
Parameters
|
|
for
Go to top |
Purpose
for($END$){$SELECTION$}
Before expansion
Parameters
|
|
if
Go to top |
Purpose
if($END$){$SELECTION$}
Before expansion
Parameters
|
|
if..else
Go to top |
Purpose
if ($COND$)
{
$SELECTION$
}
else
{
$END$
}
Before expansion
Parameters
|
|
lock
Go to top |
Purpose
lock ($LOCK$)
{
$SELECTION$$END$
}
Before expansion
Parameters
|
|
namespace
Go to top |
Purpose
namespace $NAME$ {$END$$SELECTION$}
Before expansion
Parameters
|
|
String.Format
Go to top |
Purpose
string.Format($SELECTION$, $END$);
Before expansion
Parameters
|
|
try..catch
Go to top |
Purpose
try {$SELECTION$} catch ($EXCEPTION$ $EX_NAME$)
{
$SELSTART$System.Console.WriteLine($EX_NAME$);$SELEND$
}
Before expansion
Parameters
|
|
try..finally
Go to top |
Purpose
try {$SELECTION$} finally
{
$END$
}
Before expansion
Parameters
|
|
using
Go to top |
Purpose
using($END$){$SELECTION$}
Before expansion
Parameters
|
|
while
Go to top |
Purpose
while($END$){$SELECTION$}
Before expansion
Parameters
|
