[IronPython] How to get System.Single[]?

Kevin Bjorke KBjorke at nvidia.com
Thu Jun 22 14:16:00 CEST 2006

Yes, that's it,

a=System.Array.CreateInstance(System.Single, 3)

combined with System.Convert.ToSingle() and a.SetValue() to insert
values other than zero


-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs
Sent: Thursday, June 22, 2006 3:28 AM
To: Discussion of IronPython
Subject: Re: [IronPython] How to get System.Single[]?

Kevin Bjorke wrote:
> I need to create a list of Singles to use
> System.Drawing.Darwing2D.ColorBlend's Position member. Color me
> ignorant, but how can I create such a thing? I can't just pass a list
> floats

It would be convenient to pass a tuple of floats, too bad this doesn't
You can use System.Array.CreateInstance to create a Single[]:

 >>> System.Array.CreateInstance(System.Single, 3)
System.Single[](0.0, 0.0, 0.0)

Hope this helps.

users mailing list
users at lists.ironpython.com
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

More information about the Ironpython-users mailing list