ReSharper 2021.1 Help

Predefined Surround Templates for VB.NET

ReSharper | Templates Explorer | Surround Templates | VB.NET

This topic lists all predefined surround templates for VB.NET in ReSharper 2021.1. For more information about surround templates, see Surround Code Fragments with Templates

TemplateDetails
If

Put the selection into the statement block following Then in the If-Then construct

Scope VB.NET 8.0+ statements

Body

If $END$ Then $SELECTION$ End If

Parameters

  • SELECTION- The text selected by the user before invoking the template.

  • END- The caret position after the template is applied.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

If..Else

Put the selection into the statement block following Then in the If-Then-Else construct

Scope VB.NET 8.0+ statements

Body

If $COND$ Then $SELECTION$ Else $END$ End If

Parameters

  • COND- no macro

  • SELECTION- The text selected by the user before invoking the template.

  • END- The caret position after the template is applied.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

SyncLock

Transform the selection into the SyncLock statement

Scope VB.NET 8.0+ statements

Body

SyncLock $END$ $SELECTION$ End SyncLock

Parameters

  • SELECTION- The text selected by the user before invoking the template.

  • END- The caret position after the template is applied.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

Using

Put the selection into the Using statement

Scope VB.NET 8.0+ statements

Body

Using $END$ $SELECTION$ End Using

Parameters

  • SELECTION- The text selected by the user before invoking the template.

  • END- The caret position after the template is applied.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

tc

Wrap the selection into the TryCast

Scope VB.NET 8.0+ expressions

Body

TryCast($SELECTION$, $TYPE$)

Parameters

  • TYPE- Guess type expected at this point(guessExpectedType)

  • SELECTION- The text selected by the user before invoking the template.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

ct

Transform the selection into the first parameter of the CType() function

Scope VB.NET 8.0+ expressions

Body

CType($SELECTION$, $TYPE$)

Parameters

  • TYPE- Guess type expected at this point(guessExpectedType)

  • SELECTION- The text selected by the user before invoking the template.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

dc

Transform the selection into the first parameter of the DirectCast function.

Scope VB.NET 8.0+ expressions

Body

DirectCast($SELECTION$, $TYPE$)

Parameters

  • TYPE- Guess type expected at this point(guessExpectedType)

  • SELECTION- The text selected by the user before invoking the template.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

namespace

Add a namespace to the selected code

Scope VB.NET 8.0+ types or namespaces

Body

Namespace $END$ $SELECTION$ End Namespace

Parameters

  • SELECTION- The text selected by the user before invoking the template.

  • END- The caret position after the template is applied.

Before expansion

ReSharper: Live templates
After expansion
ReSharper: Live templates

Last modified: 12 July 2021