IMathLinkGetObject Method

Reads a single expression off the link and returns an appropriate object.

Definition

Namespace: Wolfram.NETLink
Assembly: Wolfram.NETLink (in Wolfram.NETLink.dll) Version: 2.0.0.0
C#
Object GetObject()

Return Value

Object

Remarks

This method works to read any expression that has a "natural" mapping into a .NET type. The following table shows how expressions are read:
Incoming Wolfram Language expressionRead as:
IntegerInt32
RealDouble
True or FalseBoolean
Nullnull
StringString
Complex numberComplex type
FunctionArray
Note that all incoming functions are read as an Array.

The IKernelLink interface overrides GetObject to allow object references to be read (that is, NETObject expressions arriving from the Wolfram Language are read as the objects they refer to).

This method is convenient in some circumstances because it lets .NET/Link figure out the correct way to read whatever expression is waiting. For example, you may simply want to discard the expression, or you may prefer to use mechanisms in your programming language to determine what type it is (like the C# is operator) rather than MathLink mechanisms. Another example is if you will be passing the expression to a method typed to take a generic Array, you can use GetObject to read any Wolfram Language array (any type, any depth).

Exceptions

MathLinkExceptionIf the waiting data cannot be read in this format, or on any other MathLink error.

See Also