Click or drag to resize
UtilArrayToVariantArray Method
Convert an array of .NET built-in types to an equivalent Variant arrray (array of .NET Objects)

Namespace: ASCOM.Utilities
Assembly: ASCOM.Utilities (in ASCOM.Utilities.dll) Version: 6.0.0.0 (6.2.0.2774)
Syntax
public Object ArrayToVariantArray(
	Object SuppliedObject
)

Parameters

SuppliedObject
Type: SystemObject
The array to convert to variant types

Return Value

Type: Object
A Variant array
Exceptions
ExceptionCondition
InvalidValueExceptionIf the supplied array contains elements of an unsuported Type.
InvalidValueExceptionIf the array rank is outside the range 1 to 5.
InvalidValueExceptionIf the supplied object is not an array.
Remarks
This function will primarily be of use to Scripting Language programmers who need to convert Camera and Video ImageArrays from their native types to Variant types. If this is not done, the scripting language will throw a type mismatch exception when it receives, for example, Int32 element types instead of the expected Variant types.

A VBScript Camera usage example is: Image = UTIL.ArrayToVariantArray(CAMERA.ImageArray) This example assumes that the camera and utilities objects have already been created with CreateObject statements.

The supported .NET types are:

  • Int16
  • Int32
  • UInt16
  • UInt32
  • UInt64
  • Byte
  • SByte
  • Single
  • Double
  • Boolean
  • DateTime
  • String

The function supports arrays with 1 to 5 dimensions (Rank = 1 to 5). If the supplied array already contains elements of Variant type, it is returned as-is without any processing.

See Also