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 tha开发者_如何学编程t generate the error message:
Dim acceptedExtensions = New String() {".jpg", ".png", ".gif"}
Can someone help me please?
Specify the type of your variable as String()
:
Dim acceptedExtensions As String() = New String() {".jpg", ".png", ".gif"}
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.
精彩评论