ReSharper 2019.2 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 2019.2. For more information about surround templates, see Surrounding Code Fragments with Templates

Template

Details

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: 13 November 2019