Which collection interface should I use in .NET for COM-interop?
- by jhominal
That is a followup from my previous question, but you don't need to read it to understand that one.
I'm designing an interface in .NET that would be consumed from COM applications (mainly VB6, but Visual C++ 6 is also a possibility) and I would like to use Collection types as argument and return types for the methods in the interface.
Questions:
What happens to the VB6 built-in collection types (arrays, collections, dictionaries) when they go through interop? My current guess is that:
arrays - System.Array
collections - Microsoft.VisualBasic.Collection
dictionaries - System.Collections.Hashtable
Is that correct?
Which interfaces should I use as return types? IEnumerable, ICollection, IList, IDictionary? Would I be able to do a For Each in VB6 to iterate over these interfaces? Should I use the generic or non-generic variants of the interfaces?