[IronPython] Q: How to resize an System.Array ?

Haibo Luo haiboluo at exchange.microsoft.com
Fri Jan 12 17:50:28 CET 2007


dateHeap is a type in your code snippet below. The following code works, but I am not 100% sure it is expected to see the exception thrown for the last line. Dino?

>>> import System
>>> t = System.Array[System.Byte]
>>> a = t([1,2])
>>> System.Array.Resize[System.Byte](a, 10)
System.Byte[](1, 2, 0, 0, 0, 0, 0, 0, 0, 0)
>>> System.Array.Resize(a, 10)
Traceback (most recent call last):
  File , line 0, in <stdin>##27
TypeError: no callable targets, if this is a generic method make sure specify the type parameters


-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bernd Viehmann
Sent: Friday, January 12, 2007 3:47 AM
To: users at lists.ironpython.com
Subject: [IronPython] Q: How to resize an System.Array ?

Hi,

 I have some problems with using >System.Array<-instances in ipy.

I have found a way to create them, but not how to use the :-). Basically
i want 2 use a MemoryStream in the following way  ( kind of C#-way :-) ) :

        dataHeap = System.Array[System.Byte]
        dataHeap.Resize(dataHeap,4096)
        bytesRead = reader.Read(dataHeap, 0, PiceLength)

But ipy does not understand me. I receive the message:

        dataHeap.Resize(dataHeap,4096)
TypeError: no callable targets, if this is a generic method make sure
specify the type parameters

Any ideas who to use the mem-stream?

Thanks much.

 Bernd








_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list