Ian Ringrose
Ian Ringrose

Reputation: 51927

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

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?

Upvotes: 28

Views: 10367

Answers (1)

SLaks
SLaks

Reputation: 888283

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"

Upvotes: 33

Related Questions