Reputation: 219
I am getting this error message:
Warning 1 Variable declaration without an 'As' clause; type of Object assumed.
And here is the line of code that generate the error message:
Dim acceptedExtensions = New String() {".jpg", ".png", ".gif"}
Can someone help me please?
Upvotes: 1
Views: 669
Reputation: 30398
Just use Option Infer
, and the compiler will infer the type as String()
.
Option Infer On
...
Dim acceptedExtensions = New String() {".jpg", ".png", ".gif"}
The warning message indicates you have Option Strict Off
. I definitely recommend always using Option Strict On
to avoid all sorts of problems.
Upvotes: 0
Reputation: 837946
Specify the type of your variable as String()
:
Dim acceptedExtensions As String() = New String() {".jpg", ".png", ".gif"}
Upvotes: 6