MapThread error with NET/Link function
- To: mathgroup at smc.vnet.net
- Subject: [mg85284] MapThread error with NET/Link function
- From: Yvon <ymgrigsb at yahoo.com>
- Date: Tue, 5 Feb 2008 06:05:46 -0500 (EST)
I have created a .NET library (using C#) that I'm using in Mathematica. I have the following method defined in a Data class: public void SetClusterIds(long recordId, int[] clusterId) In Mathematica when I do the following, the method works as expected: dataSet = NETNew["TestLib.Data"] ... dataSet@SetClusterIds[5577,{1,2,2,2,2,0,0,0,0,0}] If I then have a one dimensional array recordId = {5577,5576,5575} and a two-dimensional array clusterIds = {{1,2,2,2,2,0,0,0,0,0}, {1,2,1,2,1,0,0,1,1,2},{1,0,2,2,2,2,2,2,0,0}} in Mathematica and try to do a MapThread to the .NET method above: MapThread[dataSet@SetClusterIds[#1&,#2&],{recordId,clusterIds}] I get the following error: NET::methodargs: Improper arguments supplied for method named SetClusterIds. {$Failed[5577, {1, 2, 2, 2, 2, 0, 0, 0, 0, 0}], $Failed[ 5576, {1, 2, 1, 2, 1, 0, 0, 1, 1, 2}], $Failed[5575, {1, 0, 2, 2, 2, 2, 2, 2, 0, 0}]} The $Failed arguments look like what I want for input into the method, which is puzzling. (I've also tried MapThread[dataSet@SetClusterIds, {recordId,clusterIds}] but the error then says there are not enough parameters supplied, or something to that effect...) Does MapThread not work for NETLink methods? Or does my .NET class method need to be structured differently to get it to work with MapThread? Thanks in advance for your help! Yvon