Passing arrays directly to .NET is not really possible because you can't actually match the Array type exactly via COM interop. It's possible to receive an array from .NET and read it and in some cases even modifiy elements, but passing it back to .NET is not really an option with plain COM Interop.
Viv's idea is a good one and one that I would recommend if you stick with plain COM Interop: Create helper methods that let you manipulate the array in .NET in your code for things like adding, removing and updating items.
unfortunately that doesn't work if you don't own the code you're accessing :-{
The real problem is that it's near impossible to simualte an array type in FoxPro that matches a .NET array signature (unless you pass it as object and then manually convert the generic untyped array, which is very ugly).
A workaround for this is what I've built into wwDotNetBridge which is basically an array proxy class that lives in .NET called ComAarray. It lets you create an array instance with a given type and pass that to .net instead. wwDotNetBridge then automatically tries to broker the array types into the appropriate .NET types from the COM array instance. Sounds complicated but is actually much easier to work with than native arrays in VFP for many things (ie. adding, removing, clearing items etc.)
http://www.west-wind.com/webconnection/docs/_2rv0njk2g.htmHopefully soon I'll write this up as an article and provide wwDotNetbridge separately from the current packaging in Web Connection and the West Wind Client Tools.
Hope this helps,
+++ Rick ---
>My C# COM DLL has a public method with the following signature:
>
>public void AddClientsToList(Contact[] contacts, string listName)
>
>
>In VFP, I do the following:
- Call a DLL method to get a new contact object
- Populate the properties
- Create an array and place the object in the first element
- Call COMARRAY(loDLL,10)
>When I attempt loDLL.AddClientsToList(@MyArray, "test"), I get a type mismatch COM error.
>
>Any ideas on what I'm doing wrong?