ComArray.AssignFrom

Assigns a .NET array to this COM wrapper from an instance variable.

This method is necessary to avoid the array hitting FoxPro code and getting converted to a COM/FoxPro array.

Once the ComArray instance has been created you can modify the array as needed without having to reassign it - the reference automatically updates the source array that you assigned from.

public bool AssignFrom(object baseInstance,
	string arrayPropertyName);

Parameters

baseInstance
Instance of the parent object of the array

arrayPropertyName
Name of the array property on the parent instance

Example

*** loResponse contains an ErrorCodes Array
loResponse =  loProxy.BalanceEnquiry(loEnquiry)

IF loResponse.Status # "0"
   *** Create a COM Array
   loArray = loBridge.CreateInstance("Westwind.WebConnection.ComArray")
   loArray.AssignFrom(loResponse,"ErrorCodes")

   ? loArray.Count 

   *** Retrieve the first error
   loError = loArray.Item(0)
    ? loError.ErrorCode 
    ? loError.ErrorCodeDesc

    *** Add an error
    loErrorCode = loArray.CreateItem()
    loErrorCode.ErrorCode = 1
    loErrorCode.ErrorCodeDesc = "New Error"
    loArray.AddItem(loErrorCode)
ENDIF

See also:

Class ComArray | ComArray.AssignTo

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