This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Add-ons & Links / .NET/Link / Introduction /


Note: This User Guide is very incomplete. An update to .NET/Link that will greatly increase the content of this User Guide and example programs is in progress. This update may already be available by the time you read this. Visit the .NET/Link home page to download the newest version.

Welcome to .NET/Link, a product that integrates Mathematica and Microsoft's .NET platform. .NET/Link lets you call .NET from Mathematica in a completely transparent way, and allows you to use and control the Mathematica kernel from a .NET program. For Mathematica users, .NET/Link makes the entire .NET world an automatic extension to the Mathematica environment. For .NET programmers, .NET/Link turns Mathematica into a scripting shell that lets you experiment with, build, and test .NET classes a line at a time. It also makes .NET an ideal environment for writing programs that use the computational services of Mathematica.

.NET/Link's most unique feature is that it lets you load arbitrary .NET types into Mathematica and then create .NET objects, call methods, properties, and so on, directly from the Mathematica language. Thus, you can use Mathematica to "script" the functionality of an arbitrary .NET program—in effect, write a .NET program in Mathematica. Essentially anything you can do from .NET, you can now do from Mathematica perhaps even more easily because you are working in a true interpreted environment.

.NET/Link also lets you do some very useful things that do not appear to directly involve the .NET runtime. This includes calling C-style DLL functions directly from Mathematica, and creating and scripting COM objects, much like Visual Basic can do.

.NET/Link is designed for end-users and developers alike. The same features that let Mathematica users transparently call any .NET method also let developers create sophisticated commercial add-ons to Mathematica. Programmers who want to write custom front ends for Mathematica or use Mathematica as a computational engine for another program will find using .NET with .NET/Link is easier than using the traditional MathLink interface from C or C++.

Finally, .NET/Link comes with full source code. You can examine the code to supplement the documentation, get tips for your own programs, better understand how to use advanced features, or just see how it works.

Some familiarity with both the .NET Framework and Mathematica is assumed in this manual. In Part 2, which covers writing .NET programs that call Mathematica, major examples are generally provided in both C# and Visual Basic .NET versions, although overall the documentation is perhaps slightly more C#-centric. Naturally, when writing .NET programs that use .NET/Link, you can use any .NET-aware languiage, not just C# and Visual Basic .NET.

Part 1 of this User Guide describes how you use .NET/Link to call .NET from Mathematica and Part 2 describes how to call Mathematica from .NET.