ArrayList:For Each vs Enumerator ...问题 [英] ArrayList: For Each vs Enumerator ... question
本文介绍了ArrayList:For Each vs Enumerator ...问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
当遍历一个更快的ArrayList时?
每个项目都是me.ArrayList
.....
.....
下一页
或
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
Enumerator.MoveNext()
...
...
结束时
谢谢,
Rob Panosh
Hello,
When traversing an ArrayList which is faster?
For Each oItem as Something in me.ArrayList
.....
.....
Next
OR
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
While Enumerator.MoveNext()
...
...
End While
Thanks,
Rob Panosh
推荐答案
我认为除了一个漂亮的代码与你相比,你会觉得没什么区别>
第一个选项。
For Each语句也使用IEnumerator接口,但是
简化了你的使用。
-----------
Rafael Pivato
Rob Panosh < RO ************************ @ asdsoftadfdware.com> escreveu na
mensagem news:ei ************** @ TK2MSFTNGP11.phx.gbl ...
I think you will feel no difference other than a beautiful code with the
first option.
The For Each statement also uses the IEnumerator interface, but it
simplifies the use for you.
-----------
Rafael Pivato
"Rob Panosh" <ro************************@asdsoftadfdware.com> escreveu na
mensagem news:ei**************@TK2MSFTNGP11.phx.gbl...
你好,>
当遍历一个更快的ArrayList时?
对于每个oItem都是我的东西.ArrayList
....
....
接下来
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
Enumerator.MoveNext ()
...
...
结束时
谢谢,
Rob Panosh
Hello,
When traversing an ArrayList which is faster?
For Each oItem as Something in me.ArrayList
....
....
Next
OR
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
While Enumerator.MoveNext()
...
...
End While
Thanks,
Rob Panosh
" Rob Panosh" < ro ************************ @ asdsoftadfdware.com>
schrieb
"Rob Panosh" <ro************************@asdsoftadfdware.com>
schrieb
你好,
当遍历一个更快的ArrayList?
对于每个oItem作为我的东西.ArrayList
....
....
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
而Enumerator.MoveNext()
......
...
结束时
Hello,
When traversing an ArrayList which is faster?
For Each oItem as Something in me.ArrayList
....
....
Next
OR
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
While Enumerator.MoveNext()
...
...
End While
两个版本都相同。 For Each也使用IEnumerator界面。
-
Armin
Both versions are equal. For Each also uses the IEnumerator interface.
--
Armin
谢谢......
" Rafael Pivato" < RP ***** @ cpovo.net>在留言中写道
新闻:eX ************** @ tk2msftngp13.phx.gbl ...
Thanks ...
"Rafael Pivato" <rp*****@cpovo.net> wrote in message
news:eX**************@tk2msftngp13.phx.gbl...
我觉得你会觉得除了带有
第一个选项的漂亮代码之外没有区别。
For Each语句也使用IEnumerator接口,但它简化了对你的使用。
-----------
Rafael Pivato
Rob Panosh < RO ************************ @ asdsoftadfdware.com> escreveu na
mensagem新闻:ei ************** @ TK2MSFTNGP11.phx.gbl ...
I think you will feel no difference other than a beautiful code with the
first option.
The For Each statement also uses the IEnumerator interface, but it
simplifies the use for you.
-----------
Rafael Pivato
"Rob Panosh" <ro************************@asdsoftadfdware.com> escreveu na
mensagem news:ei**************@TK2MSFTNGP11.phx.gbl...
你好,
>当遍历一个更快的ArrayList时?
对于每个oItem都是我的东西.ArrayList
....
....
下一个>
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
Enumerator.MoveNext()
...
...
结束时
谢谢,
Rob Panosh
Hello,
When traversing an ArrayList which is faster?
For Each oItem as Something in me.ArrayList
....
....
Next
OR
Dim oItem as Something
Dim Enumerator as IEnumerator = me.ArrayList.GetEnumerator()
While Enumerator.MoveNext()
...
...
End While
Thanks,
Rob Panosh
这篇关于ArrayList:For Each vs Enumerator ...问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文