What is the difference between Dim v As String() and Dim v() As String?

前端 未结 7 969
北恋
北恋 2020-11-27 08:03

This may sound trivial, but what is the difference between

Dim v As String()

and

Dim v() As String

in VB.

7条回答
  •  庸人自扰
    2020-11-27 08:55

    No difference. From the VB.NET Language Specification on Arrays:

    Array types are specified by adding a modifier to an existing type name. The modifier consists of a left parenthesis, a set of zero or more commas, and a right parenthesis.

    ...

    A variable may also be declared to be of an array type by putting an array type modifier or an array initialization modifier on the variable name. In that case, the array element type is the type given in the declaration, and the array dimensions are determined by the variable name modifier. For clarity, it is not valid to have an array type modifier on both a variable name and a type name in the same declaration.

提交回复
热议问题