.NET/Link API Version 1.7 USE FRAMES

Expr.AsArray Method 

Converts the Expr to an array of the requested type and depth.

[Visual Basic]
Public Function AsArray( _
   ByVal reqType As ExpressionType, _
   ByVal depth As Integer _
) As Array
public Array AsArray(
   ExpressionType reqType,
   int depth


The type of the leaf elements. Must be ExpressionType.Integer or ExpressionType.Real.
The desired depth of the array. Must be 1 or 2.


The requested element type must be either ExpressionType.Integer or ExpressionType.Real, and the depth must be 1 or 2. In other words, 1- or 2-dimensionals arrays of integers or doubles can be extracted from an Expr object using this method.

Some Exprs represent large lists or arrays of integers or reals. This method is the only efficient way of extracting the raw array data from out of the Expr. To preserve the immutability of Exprs, however, the returned array is a copy of the Expr's internal array data.


Exception TypeCondition
ArgumentExceptionIf depth > 2 or the requested type is not supported.
ExprFormatExceptionIf the Expr cannot be converted to this format.

See Also

Expr Class | Wolfram.NETLink Namespace