Handling Arrays

Arrays are one of the more tricky things to access in .NET because of FoxPro's limited and very different array implementation from .NET's. While you can fairly easily receive arrays from .NET and use them in FoxPro code, modifying and updating them is much more tricky and is better handled inside of .NET itself.

The proxy generator - via wwDotNetBridge - provides two helper mechanisms to access arrays in .NET more easily. The following operations are available and are described in the wwDotnetBridge documentation:

  • ComArray Class
    The ComArray class is a wrapper type that wwDotNetBridge provides to abstract a one dimensional array so that FoxPro can easily use it. wwDotNetBridge will return arrays as a ComArray instance and you can manually create ComArray instances which can then be passed instead of arrays to raw .NET functions. Array parameters and array results in generated proxy methods are automatically marshaled to ComArray instances.

  • Array Manipulation Methods
    The array manipulation methods on the wwDotNetBridge instance allow you to easily create an array, retrieve, add and remove items. These are most commonly used on child properties on the objects you pass or receive back from services rather than directly for parameters or return values which are automatically marshaled to ComArrays.

Remember that wwDotNetBridge is always available on your generated FoxPro proxy class as:

loBridge = loProxy.oBridge

and your actual .NET service instance is available as:

loDotNetService = loProxy.oService

Between these two you can easily access the raw .NET objects underneath the generated FoxPro proxy.


© West Wind Technologies, 2004-2020 • Updated: 09/29/15
Comment or report problem with topic