Parameter Fixups for InvokeMethod(), GetProperty() and SetProperty()
When you use wwDotnetBridge's InvokeMethod()
or GetProperty()
or SetProperty()
these Proxy methods in some cases fix up the input parameters and return values to mapped types to make it easier to access them from FoxPro.
There are two fix up mechanisms:
- Fix up method Return Values and
GetProperty()
results - Fix up Parameters or `SetProperty() calls
Return Value and GetProperty() Fixups
When you call a method with InvokeMethod()
or get a property value with GetProperty()
some result values are automatically fixed up.
The following describes how values are fixed up:
.NET Type | Returned As |
---|---|
Long/Int64 | FoxPro Decimal (Y) |
char | FoxPro String (C(1)) |
DbNull | FoxPro Null |
Array | ComArray Wrapper |
List |
ComArray Wrapper |
Dictionary<T,T1> | ComArray wrapper |
HashSet |
ComArray wrapper |
Guid | ComValue wrapper (string) |
byte | ComValue wrapper (int) |
char | ComValue wrapper (int) |
InvokeMethod()
Parameters or SetProperty()
Fixups
When you call a method via InvokeMethod()
and pass parameters, or when you call SetProperty()
to assign a value, the input value you pass from FoxPro is fixed in some cases as FoxPro cannot easily pass certain types to .NET including Value types, generic types, arrays and collections, Guids and more.
FoxPro Type | .NET Type |
---|---|
.NULL. or Null | DbNull |
VarBinary Data | byte[] |
ComArray | fixed up to ComArray.Instance |
ComValue | fixed up to ComValue.Value |
ComGuid | fixed up to ComGuid.Value |
Wrapper objects
You may notice the ComArray
, ComValue
and ComGuid
objects in the lists above. These are wwDotnetBridge helper objects that wrap .NET types with an internal instance, and methods that allow FoxPro to manipulate the object or structure which would otherwise not be directly possible using direct COM access.
ComArray for Arrays
The most common use case likely is using the ComArray class to create a .NET array and pass it to .NET. ComArray lets you create and edit .NET arrays inside of .NET without ever having to pass the actual array to FoxPro - instead you can access the individual items in the array - or collection - using the ComArray methods.
ComValue for Unsupported Foxpro Types
Additionally you may also run into types that are not supported in FoxPro or don't translate properly to .NET via COM. ComValue has helper methods that allow you to create a number of common .NET types and constructs from FoxPro values or structures that can then be passed to .NET. Most commonly when you encounter a type that's not supported you can work around the issue the ComValue class by assigning a FoxPro value to this class using one of the supported helper methods.
© West Wind Technologies, 1996-2024 • Updated: 10/21/22
Comment or report problem with topic