Dim v As String() 和 Dim v() As String 有什么区别? [英] What is the difference between Dim v As String() and Dim v() As String?

查看:86
本文介绍了Dim v As String() 和 Dim v() As String 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能听起来微不足道,但它们之间的区别是什么

This may sound trivial, but what is the difference between

Dim v As String()

Dim v() As String

在 VB.NET 中?

in VB.NET?

推荐答案

没有区别.来自 VB.NET 数组语言规范:

数组类型是通过向现有类型名称添加修饰符来指定的.修饰符由一个左括号、一组零个或多个逗号和一个右括号组成.

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.

这篇关于Dim v As String() 和 Dim v() As String 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆