Information.LBound(Array, Int32) 方法

定义

返回数组的指示维度的最小可用下标。Returns the lowest available subscript for the indicated dimension of an array.

public static int LBound (Array Array, int Rank = 1);
static member LBound : Array * int -> int
Public Function LBound (Array As Array, Optional Rank As Integer = 1) As Integer

参数

Array
Array

必需。Required. 任何数据类型的数组。Array of any data type. 希望在其中找到维度的最小可能下标的数组。The array in which you want to find the lowest possible subscript of a dimension.

Rank
Int32

可选。Optional. Integer.Integer. 将返回其最小可用下标的维度。The dimension for which the lowest possible subscript is to be returned. 对第一维使用 1,对第二维使用 2,依此类推。Use 1 for the first dimension, 2 for the second, and so on. 如果省略 Rank,则假定为 1。If Rank is omitted, 1 is assumed.

返回

Int32

Integer.Integer. 指定维度的下标可以包含的最小值。The lowest value the subscript for the specified dimension can contain. 只要 Array 已初始化,即使其中没有元素(例如,它是一个零长度字符串),LBound 也始终返回 0。LBound always returns 0 as long as Array has been initialized, even if it has no elements, for example if it is a zero-length string. 如果 ArrayNothing,则 LBound 将引发 ArgumentNullExceptionIf Array is Nothing, LBound throws an ArgumentNullException.

例外

ArrayNothingArray is Nothing.

Rank 小于 1,或 Rank 大于 Array 的级别。Rank less than 1, or Rank is greater than the rank of Array.

示例

下面的示例使用 LBound 函数来确定数组的指示维度的最小可用下标。The following example uses the LBound function to determine the lowest available subscript for the indicated dimension of an array.

Dim lowest, bigArray(10, 15, 20), littleArray(6) As Integer
lowest = LBound(bigArray, 1)
lowest = LBound(bigArray, 3)
lowest = LBound(littleArray)
' All three calls to LBound return 0.

注解

由于数组下标从 0 开始,因此每一维度最小可用的下标总是为 0。Since array subscripts start at 0, the lowest available subscript for every dimension is always 0.

对于具有以下维度的数组, LBound 返回下表中的值:For an array with the following dimensions, LBound returns the values in the following table:

Dim a(100, 5, 4) As Byte  
调用 LBoundCall to LBound 返回值Return value
LBound(a, 1) 00
LBound(a, 2) 00
LBound(a, 3) 00

适用于

另请参阅