3

I'm using pythonnet (http://pythonnet.sf.net) to bind together a python framework and a .NET library (I know if IronPython but this is not the question).

Using pythonnet, I can create an Array of floats, and initialize it from a sequence of values:

>>> from System import *
>>> Array[float]([1., 2.])
<System.Double[] object at 0x8a6c46c>

I need to pass an 3x3 array of floats to a method in the the .NET library, and I can't figure out how to create this.

1 Answer 1

4

Use Array.CreateInstance:

>>> a = Array.CreateInstance(Double, 3, 3)

reference: http://msdn.microsoft.com/en-us/library/system.array.createinstance%28v=VS.90%29.aspx

Sign up to request clarification or add additional context in comments.

2 Comments

That would create an empty 3x3 array though. How do you assign existing array values to the array?
@Jonno a.SetValue(value,pos)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.