[IronPython] Convert between python array and .NET Array

Marcel marcel.vandendungen at gmail.com
Sat Jun 12 06:51:31 CEST 2010

I have a python method that returns a Python byte array.array('c').

Now, I want to copy this array using
System.Runtime.InteropServices.Marshal.Copy. This method however
expects a .NET Array.

import array
from System.Runtime.InteropServices import Marshal

bytes = array.array('c')
Marshal.Copy(bytes, dest, 0, 3)

Is there a way to make this work without copying the data? If not, how
do I convert the data in the Python array to the .NET array?

-- Marcel

More information about the Ironpython-users mailing list