方法 : Visual Basic でコレクションを反復処理する
更新 : 2007 年 11 月
For Each ループを使用して、コレクションのすべての要素を反復処理できます。
使用例
For Each...Next ステートメント (Visual Basic) を使用してコレクションのすべての項目にアクセスするコード例を次に示します。
Dim testCollection As New Microsoft.VisualBasic.Collection()
' The collection is empty until you add one or more items to it.
For Each collectionItem As Object In testCollection
' Perform desired processing on each item.
Next collectionItem
コードのコンパイル方法
この例で必要な要素は次のとおりです。
- System 名前空間へのアクセス