IMathLinkGetObject Method
Reads a single expression off the link and returns an appropriate object.
Namespace: Wolfram.NETLinkAssembly: Wolfram.NETLink (in Wolfram.NETLink.dll) Version: 2.0.0.0
Function GetObject As Object
abstract GetObject : unit -> Object
Return Value
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 Wolfram Language expression | Read as: |
---|
Integer | Int32 |
Real | Double |
True or False | Boolean |
Null | null |
String | String |
Complex number | Complex type |
Function | Array |
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).
MathLinkException | If the waiting data cannot be read in this format, or on any other MathLink error. |