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

Dino Viehland dinov at exchange.microsoft.com
Thu Jun 22 08:37:46 PDT 2006


A slightly easier version is:

>>> System.Array[System.Single]( (1,2,3) )
System.Single[](1.0, 2.0, 3.0)

We make the System.Array class indexable by type and allow you to quickly construct arrays w/ specific values that way.

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

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

Thanks!
KB

-----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
of
> floats

It would be convenient to pass a tuple of floats, too bad this doesn't work.
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.
--
Jonathan

_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-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.
-----------------------------------------------------------------------------------
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the users mailing list