从0开始在VB6数组索引? [英] Are array indexes 0-based in VB6?
问题描述
我检讨VB6 code到C#的自动翻译和翻译转换器的someArray(3)
到的someArray [3]
。但据此向老code文档就应该选择第三个元素并不第四,因为它是在翻译版本做的。
I'm reviewing an automatic translation of VB6 code to C# and the convertor translated someArray(3)
to someArray[3]
. But accordingly to the old code documentation it should pick the third element not the fourth as it is doing in the translated version.
是数组索引0为基础的VB6?或者他们从1开始?
Are array indexes 0-based in VB6? Or do they start at 1?
推荐答案
是 - 阵列(一般)0总部设在VB6
Yes - arrays are (generally) 0 based in VB6
这个唯一的例外是当明确昏暗的someArray(1〜10)为int
语法已被使用,或当选项基本1
在code模块顶部的声明。
The exceptions to this are when the explicit Dim someArray(1 To 10) as Int
syntax has been used, or when Option Base 1
is declared at the top of the code module.
这是收藏
不在 - 当你遍历收藏
对象我pretty确定它们基于1。
It's Collections
that aren't - when you loop through Collection
objects I'm pretty sure that they are 1 based.
这篇关于从0开始在VB6数组索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!