causes a .NET call during the evaluation of expr to return its result as an object reference (i.e. a expression), not a value.


  • To use ReturnAsNETObject, you first need to load .NET/Link using Needs["NETLink`"].
  • Most .NET objects are returned as references, but those that have a meaningful Mathematica representation are returned "by value", such as strings, arrays, and so-called "boxed" values like System.Int32.
  • ReturnAsNETObject overrides the normal behavior and forces any object returned to Mathematica to be sent only as a reference.
  • ReturnAsNETObject is typically used to avoid needlessly sending large arrays of numbers back and forth between .NET and Mathematica.
  • You can use ReturnAsNETObject to cause only a reference to be sent; then you can use the NETObjectToExpression function at the end if the final value is needed.
New to Mathematica? Find your learning path »
Have a question? Ask support »