.NET/Link API Version 1.7 USE FRAMES

IMathLink.GetObject Method 

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

[Visual Basic]
Function GetObject() As Object
[C#]
object GetObject();

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 Mathematica 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 Mathematica 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 Mathematica array (any type, any depth).

Exceptions

Exception Type Condition
MathLinkException If the waiting data cannot be read in this format, or on any other MathLink error.

See Also

IMathLink Interface | Wolfram.NETLink Namespace