You really ought to take a look at the System.Collections.Generic namespace. It has several collection classes, Dictionary<> is probably the closest match to the VB6 Collection class if you use keys, List<> if you don't.
That said, the VB Collection class is still available. Project + Add Reference, choose "Microsoft.VisualBasic". Put "using Microsoft.VisualBasic" at the top of your source code. You'll however find out quickly that Collection is very awkward to use in C# due to the required type casts. Here's an example:
using Microsoft.VisualBasic; ... private void test() { Collection c = new Collection(); c.Add(0, "zero", null, null); c.Add(1, "one", null, null); c.Add(2, "two", null, null); int value1 = (int)c["two"]; // NOTE: indexing starts from 1, not 0! for (int ix = 1; ix <= c.Count; ++ix) { int value2 = (int)c[ix]; } foreach (int value in c) Console.WriteLine(value); }
|