What is the VB.NET equivalent of the C# “var” keyword?

.net, c#, vb.net

Solution

Like this:

Dim myVar = 3

You'll also need

Option Infer On

(At the top of the file or in project settings)

See "Local Type Inference"

Problem

E.g. how do I get VB.NET to statically type a local variable to be the static type of the expression on the right had side of the assignment?

Original source