Questions tagged [.netlink]

Questions about integrating Mathematica and .Net using the .NET/Link functionality provided with Mathematica.

Using the .NET/Link product, it is possible to integrate Mathematica and .Net, either calling Mathematica from a .Net application, or a .Net application/DLL from Mathematica.

Possible use cases include loading some specific function into Mathematica that is faster in C#/.Net than in pure Mathematica code, or building a user interface in .Net that integrates with Mathematica’s calculation capabilities.

119 questions
23
votes
1 answer

Using .NET 4.0 from NETLink

Using Mathematica 8, I can check the version of the .NET framework used by NETLink as follows: Needs["NETLink`"] InstallNet[]; LoadNETType["System.Environment"]; System`Environment`Version@ToString[] "2.0.50727.5448" As you can see, it is the old…
WReach
  • 68,832
  • 4
  • 164
  • 269
8
votes
2 answers

How can I create an object in NETLink from System.Collections.Generic.List

I am using NETLink and I am trying to construct the following .NET object List list = new List(); My first question is how can I load System.Collections.Generic.List? The following…
Athanassios
  • 1,291
  • 10
  • 22
7
votes
0 answers

How to use named arguments in .NET/Link (COM interface to Excel)

I am using Excel from Mathematica through .NET/Link (specifically using the COM interface). The following C# code adds a sheet after the last sheet: workbook.Sheets.Add(After: workbook.Sheets.Count); How can I use named arguments (After: in the…
David Creech
  • 1,128
  • 10
  • 15
6
votes
1 answer

Calling a dll from Mathematica

I would like to call the following function from Mathematica ps3000aOpenUnit PICO_STATUS ps3000aOpenUnit ( short * handle, char * serial ) I define the DLLFunciton in Mathematica: ps3000OpenUnit = DefineDLLFunction["ps3000aOpenUnit",…
Jozef
  • 91
  • 2
6
votes
2 answers

getting Mathematica messages in .NET

For example, equation Sin[10*x]-Log[x]==0 can't be solved by NSolve. Mathematica returns message "NSolve::nsmet". How can I get messages in my c# program? IKernelLink kl = MathLinkFactory.CreateKernelLink(); kl.WaitAndDiscardAnswer(); kl.ComplexType…
user10884
  • 61
  • 1
5
votes
2 answers

How to access graphics from .NET in Mathematica?

I would like to use Wolfram.NETLink.MathKernel.Graphics to retrieve an image generated from a Mathematica command. Which Mathematica command do I use to do this? using System; using System.Collections.Generic; using System.ComponentModel; using…
sav
  • 153
  • 4
4
votes
1 answer

How to output from a .NET console app to an existing Notebook in Mathematica?

I'm wondering if its possible push output from a .NET console application to an existing Notebook that is open in Mathematica. The reason I'd like this is that I want to use Mathematica as a "debugging console" for intermediate calculations that I…
Contango
  • 463
  • 1
  • 3
  • 10
4
votes
1 answer

Problem with .NET/Link - Unable to load DLL 'ml32i4.dll'

I have programmed this example for the last 6 years with various versions of Mathematica and .NET. This year I have moved to Version 10.0.2 and it doesn't work. I am using Visual Studio 12 for C#. My C# code is unremarkable: string[] mlArgs = {…
4
votes
2 answers

A .NET exception occurred: System.IO.FileLoadException:Could not load file or assembly

Note: Answering my own question as a wiki for future reference. When loading a .Net DLL: << NetLink` InstallNET[] LoadNETAssembly["C:\\Temp\\XYZ.dll"] NETAssembly["XYZ", 1] I get the error: NET::netexcptn: A .NET exception occurred:…
WolframFan
  • 1,412
  • 14
  • 21
4
votes
0 answers

Is it possible to load F# types using .NET/Link?

Suppose I define a type in F# such as: type person = { name: string; age: int; height: float } member per.growChild () = { per with age=age+1; height=height+10.0 } Can I load this type in Mathematica and use the associated member methods? All of…
ndalchau
  • 41
  • 1
3
votes
0 answers

VS c# NetLink - pictureBox - MathCommand

Has anyone experiance or a running example how to use within VS C# the NetLink.UI pictureBox to plot graphics, especially using the pictureBox - "MathCommand" I use the code example below which throw a System.FormatException - wrong input character…
wezi
  • 31
  • 2
3
votes
0 answers

Does .NET/Link work with .NET 7.0 assemblies?

Is it possible to call methods in a .NET 7.0 assembly from Mathematica? If so, then how is that accomplished? This is my first foray using .NET/Link. I was able to get a test project working that calls .NET Framework 4.7.2 assemblies. But calling an…
CalvinDale
  • 301
  • 1
  • 5
3
votes
0 answers

How to do simple operations on the .Net side using NETLink`?

I am trying to learn how the NETLink functionality works. Consider the following example: I import the library: Needs["NETLink`"]; I fire up the runtime environment: InstallNET[]; I create a console so I can see things on the .Net…
user13892
  • 9,375
  • 1
  • 13
  • 41
3
votes
0 answers

Use NETLink to call C# code that uses packages from nuget

I can successfully load and run methods of a static class I have written in c# using: Needs["`NETLink"]; ReinstallNET[ "MonoPath" -> "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono",\ "Force32Bit" ->…
lac
  • 151
  • 3
3
votes
1 answer

Replacing lambda expressions in LINQ queries through NET/Link

We have an IEnumerable Objects in C# that we want to import into the Wolfram Financial Platform. In the current C# API, we use LINQ queries to select from the Objects the specific Object that we need. In Wolfram Financial Platform we can import the…
1
2 3