What is the purpose of Array.GetLowerBound(int)?

前端 未结 3 924
逝去的感伤
逝去的感伤 2021-02-19 10:01

I don\'t understand the purpose of Array.GetLowerBound().

Does it ever return non-zero? When? How?

Thanks.

3条回答
  •  既然无缘
    2021-02-19 10:32

    There is one CreateInstance call that sets non-zero lower bounds:

    CreateInstance(Type, Int32[], Int32[])
    Creates a multidimensional Array of the specified Type and dimension lengths, with the specified lower bounds.

    Compare this to:

    CreateInstance(Type, Int32[])
    Creates a multidimensional Array of the specified Type and dimension lengths, with zero-based indexing. The dimension lengths are specified in an array of 32-bit integers.

    (Or to any of the other overloads, in fact. Of the six CreateInstance overloads, five create a zero-based array.)

提交回复
热议问题