[IronPython] System.Byte[]

Jim Hugunin jim at ironpython.com
Fri Oct 15 05:04:01 CEST 2004


This particular issue is just a weakness in the current IronPython-0.6.
System.Byte should definitely be auto-converted to a System.Type object when
passed to a method that requires one.  This means that you should be able to
do:
    System.Array.CreateInstance(System.Byte, 2048)

I expect this will just work in IronPython-0.7.  Even though this case will
work, there still needs to be a better way of going back and forth between
Python and CLR type objects.  For example, I'd like to call
System.Byte.GetMethods().  This won't currently work because Python type
objects don't have this method.  I'd like some way of doing this without
going through the string-based reflection API that's required today.

-Jim

Keith J. Farmer wrote:
> Sounds like a call for a CLR namespace in Python to disambiguate System
> -- or at least aliases for the CLR types.
>
> -----Original Message-----
> From: users-ironpython.com-bounces at lists.ironpython.com
> [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
> Brian Lloyd
> Sent: 14 Oct 2004 09:00
> 
>   # 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)
> 
> _______________________________________________
> users-ironpython.com mailing list
> users-ironpython.com at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com





More information about the Ironpython-users mailing list