MakeNETObject

MakeNETObject[expr]
constructs a .NET object that represents the given Mathematica expression.

MakeNETObject[expr, type]
creates an object of the specified type from expr.

DetailsDetails

  • To use MakeNETObject, you first need to load .NET/Link using Needs["NETLink`"].
  • MakeNETObject accepts numbers, True/False, strings, and lists of these, up to three deep.
  • This is a shortcut to calling NETNew, and it is especially useful for arrays, as the array object can be created and initialized with values in a single call.
  • Use the type argument to force a nonstandard type.
  • For example, MakeNETObject[{1, 2, 3}] will create an array of int (type System.Int32[]). If you want an array of Int16, use MakeNETObject[{1, 2, 3}, "System.Int16[]"].
New to Mathematica? Find your learning path »
Have a question? Ask support »