[IronPython] Array element access of C# extension.
HEMMI, Shigeru
textdirected at gmail.com
Fri Apr 28 03:28:38 CEST 2006
Hello group,
I wish to access each element value of single-dimension array in C# extension
from IP. For example, a static method foo.goo defined in C# code,
// fooLib.cs
using System;
namespace fooLib
{
public static class foo
{
public static void goo(int n, double[] x, double[] y)
{
for(int i=0; i<n; i++)
{
x[i] = i;
y[i] = 1.0/i;
}
}
}
}
can be accessed from C# main program:
// testing.cs
using System;
using fooLib;
class testing
{
public static void Main()
{
int n = 10;
double [] x = new double[n];
double [] y = new double[n];
foo.goo(n, x, y);
Console.WriteLine("x[9],y[9]="+x[9]+", "+y[9]);
}
}
I struggled to write an IP code similar to testing.cs but not done,
because of Python has no corresponding simple array data type.
Can anybody show me how I can access each element value of C#
extention like fooLib.cs from IP code?
Thanks in advance,
Best regards,
More information about the Ironpython-users
mailing list