Reads a single expression off the link and returns an appropriate object.
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 expression | Read as: |
---|---|
Integer | Int32 |
Real | Double |
True or False | Boolean |
Null | null |
String | String |
Complex number | Complex type |
Function | 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).
Exception Type | Condition |
---|---|
MathLinkException | If the waiting data cannot be read in this format, or on any other MathLink error. |
IMathLink Interface | Wolfram.NETLink Namespace