Hi.
In your VB6 sample code, you are retrieving items using a key, that is like a dictionary.
You did not include VB6 sample code that adds items, but having IPString as the parameter to fetch tems, the instructions you used were like
pCollConn.Add item, IPString
.
There are different matching classes, depending of the way you add or retrieve items in VB6.
First of all, the VB6 Collection class is fully matched by
Microsoft.VisualBasic.Collection, from the Microsoft.VisualBasic.dll assembly (see
Collection class): the simplest conversion would be to use that class, but depending on each usage case, you may found other classes suit best.
Examples:
- If you add items passing only 1 parameter, that is the item, and retrieve the items only by looping, than the best options are
ArrayList or
List<T> (where T is the type of the item if it is always the same for that collection object).
- If you add items passing only 1 parameter, the item, and retrieve them by index, than the best options would be again
ArrayList or
List<T>.
- If you add items passing only 1 parameter, the item, and later checks for existance, than you should adopt
HashSet<T> or
Collection<T>.
- If you add passing 2 parameters, that are the item value and the item key, and retrieve values by key, then you should use
HashTable or
Dictionary<TKey,TValue> or
SortedList<TKet,TValue>.
There are even more classes you can choose from, but the ones listed above are the most common.
Regards,
Daniele.