ReSharper | Templates Explorer | Live Templates | VB.NET"
This topic lists all predefined live templates for VB.NET in ReSharper 2023.1. For more information about live templates, see Create source code using live templates.
Template
Details
ctx
Current file context
Scope Everywhere
Body
$CTX$
Parameters
CTX - Provides a list of items describing current context. This includes file name, containing type name, namespace name, etc.
nguid
Insert new GUID
Scope Everywhere
Body
$GUID$
Parameters
GUID - Generates a new Globally Unique Identifier (GUID)
foreach
For Each block
Scope VB.NET 8.0+ statements
Body
For Each $VAR$ As $TYPE$In $COL$
$END$Next
Parameters
COL - Shows basic code completion list at the point where the variable is evaluated
TYPE - Analyzes code and guesses type of element of a collection.
VAR - When executed in a variable declaration (where variable name should stand), suggests a name for the variable
END - The caret position after the template is applied.
Before expansion
After expansion
After you specify the parameters, the caret is positioned so that you can continue coding the loop body.
itar
Iterate an array
Scope VB.NET 8.0+ statements
Body
For $VAR$ AsInteger=0To $ARRAY$.Length-1Dim $ELEMENT$ As $TYPE$= $ARRAY$($VAR$)
$END$Next
Parameters
ARRAY - Suggests a variable whose type is an array type
VAR - Suggests a unique name for an index variable at the evaluation point
TYPE - Analyzes code and guesses type of element of a collection.
ELEMENT - When executed in a variable declaration (where variable name should stand), suggests a name for the variable
END - The caret position after the template is applied.
Before expansion
After expansion
After you specify the parameters, the caret is positioned so that you can continue coding the loop body.
For $INDEX$ AsInteger=0To $LIST$.Count -1Dim $ELEM$ As $TYPE$= $LIST$($INDEX$)
$END$Next
Parameters
LIST - Suggests variables of the specified type
INDEX - Suggests a unique name for an index variable at the evaluation point
TYPE - Analyzes code and guesses type of element of a collection.
ELEM - When executed in a variable declaration (where variable name should stand), suggests a name for the variable
END - The caret position after the template is applied.
Before expansion
After expansion
Generates a For loop which iterates over an instance of System.Collections.IList.
After you specify the parameters, the caret is positioned so that you can continue coding the loop body.
for
Simple "For" loop
Scope VB.NET 8.0+ statements
Body
For $VAR$ AsInteger=0To $MAX$
$END$Next
Parameters
VAR - Suggests a unique name for an index variable at the evaluation point
MAX - Evaluates to the specified constant value
END - The caret position after the template is applied.
Before expansion
After expansion
After you specify the parameters, the caret is positioned so that you can continue coding the loop body.
ritar
Iterate array in reverse order
Scope VB.NET 8.0+ statements
Body
For $VAR$ AsInteger= $ARR$.Length-1To0Step-1Dim $ELEM$ As $TYPE$= $ARR$($VAR$)
$END$Next
Parameters
ARR - Suggests a variable whose type is an array type
VAR - Suggests a unique name for an index variable at the evaluation point
TYPE - Analyzes code and guesses type of element of a collection.
ELEM - When executed in a variable declaration (where variable name should stand), suggests a name for the variable
END - The caret position after the template is applied.
Before expansion
After expansion
After you specify the parameters, the caret is positioned so that you can continue coding the loop body.
Dim
Declare a variable
Scope VB.NET 8.0+ statements, VB.NET 8.0+ type members
Body
Dim $VAR$ As $TYPE$
Parameters
TYPE - no macro
VAR - When executed in a variable declaration (where variable name should stand), suggests a name for the variable
Before expansion
After expansion
asrt
Make an assertion
Scope VB.NET 8.0+ statements
Body
System.Diagnostics.Debug.Assert($END$)
Parameters
END - The caret position after the template is applied.
Before expansion
After expansion
The template calls the System.Diagnostics.Debug.Assert() method. After the template expands, the caret moves between the parentheses so that you can specify a condition.
out
Print a string
Scope VB.NET 8.0+ statements
Body
System.Console.WriteLine("$END$")
Parameters
END - The caret position after the template is applied.
Before expansion
After expansion
outv
Print value of an expression
Scope VB.NET 8.0+ statements
Body
System.Console.WriteLine("$EXPR$ = {0}", $EXPR$)
Parameters
EXPR - Suggests variables of the specified type
Before expansion
After expansion
pssm
Public Shared Sub Main
Scope VB.NET 8.0+ type members
Body
PublicSharedSub Main
$END$EndSub
Parameters
END - The caret position after the template is applied.
Before expansion
After expansion
sfc
Safely cast a variable
Scope VB.NET 8.0+ statements
Body
Dim $VAR$ As $TYPE$=TryCast($EXPR$, $TYPE$)If $VAR$ IsNotNothingThen
$END$EndIf
Parameters
EXPR - Suggests variables of the specified type
TYPE - no macro
VAR - When executed in a variable declaration (where variable name should stand), suggests a name for the variable
END - The caret position after the template is applied.
Before expansion
After expansion
sub
Subroutine declaration
Scope VB.NET 8.0+ type members
Body
Sub $NAME$()
$END$EndSub
Parameters
NAME - no macro
END - The caret position after the template is applied.
Before expansion
After expansion
fun
Function declaration
Scope VB.NET 8.0+ type members
Body
Function $NAME$()As $TYPE$
$END$EndFunction
Parameters
NAME - no macro
TYPE - no macro
END - The caret position after the template is applied.