.NET Wrapper Types and Value Fixups

There are a number of types that simply don't work or work very badly inside of Visual FoxPro. For example, the .NET System.Guid type cannot be returned into Visual FoxPro and accessed directly - it simply crashes when accessed in any way in FoxPro. Arrays are another problem type because FoxPro's limited support for array management functions that don't map directly to COM's referenced based arrays.

As a workaround wwDotNetBridge provides a few wrapper types that can act as a bridge to accessing these types inside of Visual FoxPro. These types are available on calls to InvokeMethod, SetProperty and GetProperty which automatically translate inbound parameters and result values to these specialty types. They are NOT available on direct calls on .NET object instances.

Important:
These features are only available if you use the 'implicit' functions of wwDotNetBridge like InvokeMethod, GetProperty, SetProperty. If you call methods or get/set properties directly on the return .NET object instances you will not get any of this translation.

For example, if you call a method that takes a Guid parameter, pass a ComGuid instance instead and wwDotNetBridge will automatically convert the ComGuid into a .NET Guid structure. If a function or value returns a ComGuid your FoxPro code automatically receives the ComGuid wrapper type.

The following wrapper classes are available:

Wrapper ClassDescription
  Class ComArray COM Wrapper for Arrays, IList and IDictionary collections that are not directly or easily accessible in FoxPro. Provides members like Count, Item() for index or key retrieval, AddItem(), AddDictionaryItem(), RemoveItem(), Clear() to provide common collection operations more naturally in FoxPro abstracted for the different types of collections available in .NET (Arrays, Lists, Hash tables, Dictionaries).
  Class ComValue ComValue is a wwDotnetBridge .NET helper class that wraps problem .NET types that cannot be accessed in FoxPro due to COM Type Limitations. COM doesn't support many .NET types and this class allows you to use them with this wrapper object that can be passed and returned to and from the explicit invocation methods like InvokeMethod(), SetProperty(), GetProperty(), which know how to fix up the ComValue structure into real .NET types and vice versa.

In addition wwDotNetBridge also fixes up binary parameters passed .NET which are passed as SafeArrays by FoxPro and which are not correctly read as byte[] in .NET. The conversion fixes up the plain arrays into proper binary data arrays.


© West Wind Technologies, 1996-2024 • Updated: 10/21/22
Comment or report problem with topic