对于每一个 [英] For each

查看:83
本文介绍了对于每一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行循环时:对于FileInfo中的每个文件作为System.io.FileInfo

有没有办法告诉我当前正在使用哪个文件编号(索引)?

实际上我希望能够跳到特定的索引 - 或者向前或向后转换
。能够使用命令按钮设置索引或

也许会很好,然后循环移动到那个

位置并从那里继续前进。


我特别感兴趣的是在每个循环中这样做。

When I running a loop: For Each File As System.io.FileInfo In FileInfo
Is there a way to tell which file number (index) I''m currently on?
Actually I''d like the ability to skip to a particular index--either
forward or back. It''d be nice to be able to set the index back or
forward with a command button perhaps and the loop just move to that
position and continue forward from there.

I''m specifically interested in doing this in the for each loop.

推荐答案

" ; CJ" < cj@nospam.nospam> schrieb:
"cj" <cj@nospam.nospam> schrieb:
当我运行循环时:对于FileInfo中的每个文件为System.io.FileInfo
有没有办法告诉我当前在哪个文件编号(索引)?
实际上我希望能够跳到特定的索引 - 无论是向前还是向后。能够使用命令按钮向后设置索引或向后转动是很好的,然后循环移动到该位置并从那里继续前进。
我特别感兴趣的是在每个循环中这样做。
When I running a loop: For Each File As System.io.FileInfo In FileInfo
Is there a way to tell which file number (index) I''m currently on?
Actually I''d like the ability to skip to a particular index--either
forward or back. It''d be nice to be able to set the index back or
forward with a command button perhaps and the loop just move to that
position and continue forward from there.

I''m specifically interested in doing this in the for each loop.




我很好奇为什么你没有使用''For ... To''循环。


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps。 org />

VB< URL:http://classicvb.org/petition/>



I am curious why you are not using a ''For...To'' loop.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


好奇心是件好事。对?我认同。最初,我现在要求的功能没有

需要和For Each是IMHO

专门用于循环收集/数组所以我用它。 />

那么,为什么我不能改为For To等等?好吧,如果必须,我会的。

我只是好奇我是否可以在For Each中这样做。


希望有人知道。

Herfried K. Wagner [MVP]写道:
Curiosity is a good thing. Right? I think so. Initially there was no
need for the functionality I''m requesting now and For Each is IMHO
specifically made for looping through collections/arrays so I used it.

So, why don''t I change to "For To" etc now? Well, I will if I have to.
I am just curious if I could do this in For Each.

Hope someone knows.
Herfried K. Wagner [MVP] wrote:
" cj" < cj@nospam.nospam> schrieb:
"cj" <cj@nospam.nospam> schrieb:
当我运行循环时:对于每个文件作为System.io.FileInfo在文件信息中有没有办法告诉我哪个文件号(索引)我是
目前在?实际上我希望能够跳到特定的
索引 - 向前或向后。能够使用命令按钮向后或向前设置
索引会很好,并且循环只需
移动到该位置并从那里继续前进。
我特别感兴趣的是在每个循环中都这样做。
When I running a loop: For Each File As System.io.FileInfo In
FileInfo Is there a way to tell which file number (index) I''m
currently on? Actually I''d like the ability to skip to a particular
index--either forward or back. It''d be nice to be able to set the
index back or forward with a command button perhaps and the loop just
move to that position and continue forward from there.

I''m specifically interested in doing this in the for each loop.



我很好奇为什么你没有使用''For ... To''循环。



I am curious why you are not using a ''For...To'' loop.



" cj" < cj@nospam.nospam> schrieb:
"cj" <cj@nospam.nospam> schrieb:
好奇心是件好事。对?我认同。最初我没有需要我现在要求的功能而For Each是IMHO
专门用于循环收集/数组所以我使用它。
Curiosity is a good thing. Right? I think so. Initially there was no
need for the functionality I''m requesting now and For Each is IMHO
specifically made for looping through collections/arrays so I used it.




我想说它已被引入以简化循环通过集合

或基于索引的访问不重要的数组。显然后者是

在你描述的情况下很重要...


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>



I would say it has been introduced to simplify looping through a collection
or array when index-based access is not important. Obviously the latter is
important in the case you described...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


这篇关于对于每一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆