首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

这两个声明数组的方式有什么不同?解决方法

2012-01-01 
这两个声明数组的方式有什么不同?dima()asinteger{1,2,3,4,5}DimaAsInteger(){1,2,3,4,5}dimaasinteger(

这两个声明数组的方式有什么不同?
dim   a()   as   integer   =   {1,2,3,4,5}

Dim   a   As   Integer()   =   {1,   2,   3,   4,   5}

dim   a   as   integer()   =   new   integer()   {1,2,3,4,5}

如果运行:
msgbox(a.gettupperbound(0))  

结果都是4
请问以上两个声明数组的方法有什么不同
谢谢!

[解决办法]
呵呵,第一个应该很好理解的,第二个也应该是声明一个integer数组,不过可能直接构建的integer数组,integer类型的一个特例,a是他的引用地址,类似c语言的数组首引用吧,只是猜测,没研究过,或者integer()是integer类型的空构造函数?
[解决办法]
没有不同,两种声明方法生成的il是相同的。

if "il相同 " then "dim xx as yy() = dim xx() as yy "

热点排行