You can initialize the values on this like:

Array[Array[int]]( ( (1,2), (2,3) ) )

(any sequence will do here, e.g. a list work too).

If you want to create a true multi-dimensional array you can do:

x = Array.CreateInstance(int, Array[int]( (1,2,3)))

And then you can fill the values by hand:

x[0,1,2] = 2


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Anton
Sent: Wednesday, September 20, 2006 8:15 AM
To: [email protected]
Subject: [IronPython] Arrays in IronPython


After a lot of googling on this, I'm still confused about .NET arrays (not 
Python lists) in IronPython.
One dimensional arrays are clear:
foo = Array[int] ((1,2))

But how to set up jagged arrays and multidimensional arrays?

I know that IronPython is happy with the following (i.e., no error), but I'm 
not sure what they mean:
foo = Array[int][int]
foo = Array[Array[int]]

The first one behaves just like Array[int], so I think IronPython is just 
ignoring the second "[int]" ?
The second one would appear to me to be a jagged array, but how do I initialize 
it with values?

--
View this message in context: 
http://www.nabble.com/Arrays-in-IronPython-tf2306048.html#a6409948
Sent from the IronPython mailing list archive at Nabble.com.

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to