C# Development using Mathematica

Frank J. Kampas

WAM Systems

Abstract

C# is rapidly becoming the language of choice for programming in the Windows Operating System. However, development of C# applications for numerical calculations, using Microsoft Visual Studio, is difficult since there are no good facilities in Visual Studio for examining and visualizing data. This can be overcome by using .NET/Link, which enables a developer to prototype an application in Mathematica and then move the calculation, piece at a time, into C# and to compare the results of the C# code with the Mathematica prototype. I used this approach for some time but found it tedious to go back and forth between Mathematica and Visual Studio, until I realized that C# (and VB.NET) code can be compiled from within Mathematica, using the compiler built into the .NET runtime. In this presentation, I illustrate how C# code can be compiled and called inside Mathematica. Two examples are discussed in some detail, a SQL reader written with ADO.NET and linear programming code which uses the ILOG CPLEX callable library.