Creates a new ComArray instance that you can manipulte easily from FoxPro.
ComArray is a special wwDotnetBridge wrapper for .NET arrays that facilitates accessing .NET arrays without marshalling them into FoxPro and losing their .NET object status and so their updateability. ComArray is the preferred mechanism to manipulate .NET arrays from FoxPro as it allows the .NET array to stay in .NET and only marshals individual array items into FoxPro.
ComArray instances can be created with:
- loBridge.CreateArray(<.NET typename>)
- loBridge.InvokeMethod(loInst,"someMethod") where it returns an Array
ComArray is a wrapper type that can be passed to InvokeMethod() or SetProperty() and is converted by wwDotNetBridge into the native array type that is stored in the Value property thus allow keeping the array entirely in .NET without having to be marshaled into FoxPro arrays.
The full .NET typename for the array elements to be created. Each element of the array will be of this type.
Use System.Object if you need to pass mixed types for each element rather than a single type for each element.
loBridge = CREATEOBJECT("wwDotNetBridge") loService = CREATEOBJECT("Sample.MyService") *** Create an instance of the array with the *** specific type of the elements LOCAL loArr as Westwind.WebConnection.ComArray loArr = loBridge.CreateArray("System.Object") *** Add Items loArr.AddItem("New Item") loArr.AddItem(10) *** Create a .NET object and set properties loCust = loBridge.CreateInstance("Sample.Customer") loCust.Company = "West Wind" loCust.Entered = DateTime() *** Add the object to the array loArr.AddItem(loCust) *** Now call a method that takes the array as a parameter loBridge.InvokeMethod(loService,"PassArray",loArr)
See also:Class wwDotNetBridge | Class ComArray | wwDotNetBridge::InvokeMethod | wwDotNetBridge::SetProperty
Comment or report problem with topic