LabWindows/CVI

CDotNetGetArrayElements

int CDotNetGetArrayElements (CDotNetHandle array, unsigned int elementType, ssize_t *numberOfElements, void *elements);

Purpose

Returns all the elements from a .NET array.

Parameters

Input
Name Type Description
array CDotNetHandle The handle of the .NET array.
elementType unsigned int The type of the elements of the .NET array. You can pass one of the following values:

  • CDOTNET_STRING
  • CDOTNET_BOOLEAN
  • CDOTNET_SBYTE
  • CDOTNET_INT16
  • CDOTNET_INT32
  • CDOTNET_INT64
  • CDOTNET_BYTE
  • CDOTNET_UINT16
  • CDOTNET_UINT32
  • CDOTNET_UINT64
  • CDOTNET_SINGLE
  • CDOTNET_DOUBLE
  • CDOTNET_DECIMAL
  • CDOTNET_CHAR
  • CDOTNET_ENUM
  • CDOTNET_OBJECT

Pass CDOTNET_OBJECT for a .NET array of arrays (jagged array) because the element of a jagged array is itself an array and is represented by an object handle.
Output
Name Type Description
numberOfElements ssize_t The total number of elements in the array.
elements void * The elements in the array. The LabWindows/CVI .NET Library allocates a buffer and copies the elements to the buffer. You must use CDotNetFreeMemory to free the buffer. If the array contains strings, you must use CDotNetFreeMemory to free each item in the buffer. If the array contains objects, you must use CDotNetDiscardHandle to discard each handle in the buffer.

Return Value

Name Type Description
status int A value indicating whether an error occurred. Negative error codes indicate function failure.

Error codes are defined in cvi\include\cvidotnet.h.

You can use CDotNetGetErrorDescription to get the description of an error code.

Additional Information

Library: .NET Library

Include file: cvidotnet.h

LabWindows/CVI compatibility: LabWindows/CVI 8.0 and later