如何设置列表类型的索引 [英] how to set index of a list type
本文介绍了如何设置列表类型的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我有一个地址列表.
在此列表中,我只想过滤0或1个索引值.
如何过滤
dear all,
i have a address list.
in this list i want to filter only 0 or 1 index value.
how to filter
For Each objAddress As CRAddressDetails In AddressList <br />
<br />
//here i want to select addressl list 0 index<br />
<br />
next<br />
请对此提供帮助.
谢谢
Please help about this.
thanks
推荐答案
不要;不要使用For Each ...
Don;t use For Each...
For index As Integer = 0 To 1
Dim objAddress As CRAddressDetails = AddressList(index)
...
Next
AddressList是哪种类型?
CRAddressDetails []?数组列表?列出< craddressdetails> ;?字典?
在foreach循环之外,您可以编写:
what kind for AddressList?
CRAddressDetails[]? ArrayList? List<craddressdetails>? Dictionary?
outside foreach cycle you can write:
Dim zeroindex as CRAddressDetails = AddressList(0)
For Each objAddress As CRAddressDetails In AddressList
//here you can use zeroindex
next
这篇关于如何设置列表类型的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文