IMathLinkGetArray Method

Reads an array of the specified type and depth.

Remarks

Use this method when you want to read a 2-dimensional or deeper array. You will typically cast the result of this method to the desired array type, as in:
C#
// C#
int[,,] result = (int[,,]) ml.GetArray(typeof(int), 3);

// VB
Dim result(,,) as Integer = CType(ml.GetArray(GetType(Integer), 3), GetType(Integer(,,)))
The expression does not need to have head List. It can have any heads, at any depth, and the heads do not have to agree at each depth, meaning that you could read the expression {foo[1, 2], bar[3, 4]} as an int[,].

This method only works for arrays that are rectangular, not jagged. In other words, you can read a Wolfram Language list like this: {{1,2,3},{4,5,6}} but not like this: {{1,2,3},{4,5}}.

For reading one-dimensional arrays, there are convenience functions for all the simple types, such as GetInt32Array, GetBooleanArray, GetStringArray, and so on. These methods are typed to return the specified type of array, so no casting is required.

Overload List

GetArray(Type, Int32) Reads an array and discards information about the heads at each level.
GetArray(Type, Int32, String) Reads an array and records information about the heads at each level.

See Also