"Michael D. Ober" <mdo.@.wakeassoc..com> wrote in message
news:%2*****************@TK2MSFTNGP09.phx.gbl...
In VB 6, the loop iterator v in the following code must be a variant.
dim v as variant
dim c as new collection
for each v in collection
...
next v
Collection is by default non-typed (using type Object). If you were to use
a different type of collection, such as a Specialized.StringCollection, then
yes. For example:
'// .NET 1.1: Using a weak-typed Collection:
Dim C as New Collection
Dim strItem as String
....
For each V as Object In C
Debug.WriteLine DirectCast(V, String)
Next
'// .NET 1.1: Using a specialized collection:
Dim C as New Collections.Specialized.StringCollection
....
For each ThisString as String In C
Debug.WriteLine ThisString
Next
'// .NET 2: Use generics
Dim C as New Generics.Collection(Of String)
For Each ThisString as String in C
Debug.WriteLine ThisString
Next
HTH,
Jeremy