包含数组字段的结构问题 [英] a problem with Structures that contains an array field
本文介绍了包含数组字段的结构问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我有一个公共结构,其中包含一些数组,这些数组的数据类型是其他公共结构:
hello
I have a Public Structure that contains some arrays that their Data Types are other public structures:
Public Structure ResponseInfo
Public Status As string
Public Result() As Result
End Structure
Public Structure Result
Public Type() As String
Public FormattedAddress() As String
Public AddCom() As AddressComponent
Public Geometry As Geometry
End Structure
Public Structure AddressComponent
Public Long_name As String
Public short_name As String
Public type() As String
End Structure
数组的索引数在任何请求中都不同.
The number of Indexes of the arrays are different in any request.
Dim Lo_ResponseInfo as ResponseInfo
Do While Name <> ""
ReDim Lo_ResponseInfo.Result(Lnum_ResultCounter).AddCom(Lnum_AddComCounter).type(Lnum_AddComTypeCounter)
Lo_ResponseInfo.Result(Lnum_ResultCounter).AddCom(Lnum_AddComCounter).type(Lnum_AddComTypeCounter) =Lnum_AddComTypeCounter
Lnum_AddComTypeCounter += 1
Loop
由于ReDim,我所有以前的数据都将丢失.
我该怎么办?
because of ReDim all my Previous data will be lost.
What should I do??
推荐答案
您可以将数组替换为Lists:这样就可以避免完全重做.相反,只需在需要时添加新条目即可.
You could replace your arrays with Lists: that way you could avoid redim completely. Instead, just add new entries as you need them.
这篇关于包含数组字段的结构问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文