Convert an array of .NET built-in types to an equivalent Variant arrray (array of .NET Objects)

Namespace: ASCOM.Utilities.Interfaces
Assembly: ASCOM.Utilities (in ASCOM.Utilities.dll) Version: 6.0.0.0 (6.1.1.2619)

Syntax

C#
Object ArrayToVariantArray(
	Object SuppliedObject
)
Visual Basic
Function ArrayToVariantArray ( _
	SuppliedObject As Object _
) As Object
Visual C++
Object^ ArrayToVariantArray(
	Object^ SuppliedObject
)

Parameters

SuppliedObject
Type: System..::..Object
The array to convert to variant types

Return Value

A Variant 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.

Exceptions

ExceptionCondition
ASCOM..::..InvalidValueExceptionIf the supplied array contains elements of an unsuported Type.
ASCOM..::..InvalidValueExceptionIf the array rank is outside the range 1 to 5.
ASCOM..::..InvalidValueExceptionIf the supplied object is not an array.

See Also