Out of curiosity, I have been working through some of my COM and .NET Interop issues, and most specifically, working with passing arrays between to / from a C# component from Visual Basic 6.0. As my earlier post indicates, this is in response to a client’s desire to replace VB6 COM+ components with a .NET implementation in c# while minimizing changes to Classic ASP. Here are some of my findings. In cases for strongly-typed arrays, I used strings; loosely-coupled means object in .NET and variant in VB6.
- System.Array is not easily (not sure if it is possible) used with interop
- Single dimension, strongly-typed arrays are easily used with interop. In my case, I used strings. However, when used as input parameters, they must be passed byref and zero indexed.
- Two dimension, strongly-typed arrays are easily used with interop. They also have the same constraints as single dimension arrays (must be passed byref and must be zero indexed).
- Zero-indexed arrays could cause a ripple effect in COM client code and requires more investigation.