ReSharper Web Help

ReSharper | Live Templates | Live Templates | Predefined Templates | VB.NET | Other

VB.NET

Other

This group contains non-categorized templates. Templates for creating arrays, declaring public variables and creating empty methods are provided here, among others.

Template name Description
asrt

Go to top

Purpose
This template calls the System.Diagnostics.Debug.Assert() method, which is used for debugging purposes. After the template expanded, the caret moves between the parentheses so that you can specify a condition.

System.Diagnostics.Debug.Assert($END$)

Before expansion
asrt (before)
After expansion
asrt (after)

Parameters

  • END - an empty set of method arguments.

ct

Go to top

Purpose
Generates the CType() function, which is used to explicitly convert VB.NET types.

CType($EXPR$, $TYPE$)

Before expansion
ct (before)
After expansion
ct (after)

Parameters

  • EXPR - name of variable to cast from.
  • TYPE - type to cast to.

dc

Go to top

Purpose
Generates the DirectCast() function as an alternative way to perform type casts.

DirectCast($EXPR$, $TYPE$)

Before expansion
dc (before)
After expansion
dc (after)

Parameters

  • EXPR - name of variable to cast from.
  • TYPE - type to cast to.

 Note

For more details on CType vs. DirectCast see Visual Basic Language Reference: DirectCast and Visual Basic .NET Internals at MSDN.
dim

Go to top

Purpose
Declares a new variable.

Dim $VAR$ As $TYPE$

Before expansion
dim (before)
After expansion
dim (after)

Parameters

  • VAR - name of new variable.
  • TYPE - type of new variable.

fun

Go to top

Purpose
Declares a new function.

Function $NAME$() As $TYPE$
    $END$
End Function

Before expansion
fun (before)
After expansion
fun (after)

Parameters

  • NAME - name of new function.
  • TYPE - type of value to be returned by the function.
  • END - empty function body.

out

Go to top

Purpose
Outputs a string.

System.Console.WriteLine("$END$")

Before expansion
out (before)
After expansion
out (after)

Parameters

  • END - string value.

outv

Go to top

Purpose
Outputs value of an expression.

System.Console.WriteLine("$EXPR$ = {0}", $EXPR$)

Before expansion
outv (before)
After expansion
outv (after)

Parameters

  • EXPR - name of variable that is converted into string to produce the appropriate output.

pssm

Go to top

Purpose
Generates the Main() method for a VB.NET application.

Public Shared Sub Main
    $END$
End Sub

Before expansion
pssm (before)
After expansion
pssm (after)

Parameters

  • END - empty body of the Main() function.

sfc

Go to top

Purpose
Casts a variable in a safe manner, checking for null reference.

Dim $VAR$ As $TYPE$ = TryCast($EXPR$, $TYPE$)

If $VAR$ IsNot Nothing Then
    $END$
End If

Before expansion
sfc (before)
After expansion
sfc (after)

Parameters

  • VAR - name of new variable.
  • TYPE - type of new variable and (in the second occurrence) target cast type.
  • EXPR - name of variable to cast from.
  • END - empty body of verification loop.

sub

Go to top

Purpose
Declares a new subroutine.

Sub $NAME$
    $END$
End Sub

Before expansion
sub (before)
After expansion
sub (after)

Parameters

  • NAME - name of new subroutine.
  • END - empty subroutine body.

tc

Go to top

Purpose
Performs a cast that doesn't throw exceptions.

TryCast($EXPR$, $TYPE$)

Before expansion
tc (before)
After expansion
tc (after)

Parameters

  • EXPR - name of variable to cast from.
  • TYPE - type to cast to.

See Also

Reference

External Links