What is the equivalent to C# var in VB.NET

1 Answer

0 votes
Imports System

Option Infer On  ' Optional. Enables local type inference 

Public Class Test

    Public Shared Sub Main()
            ' When you set Option Infer to On, 
            ' you can declare local variables without explicitly stating a data type
            Dim v = "vb.net"
            
            Console.WriteLine(v)

    End Sub
End Class
 
 
 
' run:
'
' vb.net
'

 



answered Sep 6, 2019 by avibootz

Related questions

2 answers 181 views
1 answer 71 views
1 answer 190 views
1 answer 152 views
152 views asked Jun 25, 2022 by avibootz
1 answer 194 views
1 answer 213 views
...