[IronPython] Python List -> .Net Array (was PowerPoint Automation)

J. Merrill jvm_cop at spamcop.net
Fri Jul 8 17:12:00 CEST 2005

At 05:28 PM 6/30/2005, Martin Maly wrote (in part)
>To work with slide ranges, using Python list won't work. Unfortunately, there is no default conversion from the Python list data type to .NET array type(s). 

Is there a good reason for not having that default conversion?  

If there is a good reason, should there be an AsArray method (perhaps with another name) added to the Python List class, so that one could do the conversion manually when working with .Net classes?

The IronPython code (your sample shown below) for initializing and populating a "normal" .Net array is quite verbose compared to what we get in Python (or even C#).

>>> r=System.Array.CreateInstance(System.Int32, 5)
>>> r[0]=1
>>> r[1]=4
>>> r[2]=7
>>> r[3]=9
>>> r[4]=12

J. Merrill / Analytical Software Corp

More information about the Ironpython-users mailing list