방법: 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 네임스페이스에 대한 액세스 권한