[IronPython] System.Byte[]

Brian Lloyd brian at zope.com
Thu Oct 14 18:00:12 CEST 2004


> In C# I have 'byte[] buffer = new byte[2048];' but I can't seem to get
> the same thing with IronPython. How do you create a variable with the
> System.Byte[] type in IronPython?

A tricky way would be:

  # gotta get this in an odd way - you cant say System.Byte
  # directly, because that gives you a Python type object 
  # rather than an actual System.Type instance...
  clrtype = System.Type.GetType('System.Byte')

  buffer = System.Array.CreateInstance(clrtype, 2048)



Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716              
Zope Corporation   http://www.zope.com 





More information about the Ironpython-users mailing list