[IronPython] Typecasting in ironPython
Markus Schaber
m.schaber at 3s-software.com
Fri Mar 18 09:08:22 CET 2011
Hi, Saurabh,
Sorry for sending that borked message. Outlook 2010 is driving me nuts!
Saurabh Rawat wrote:
> NoisePath np = (NoisePath)255
This is C syntax which obviously doesn't work in (Iron)Python. Python is
a dynamically typed language, so type casts do not exist "by design".
But the enum class has a toobject method:
http://msdn.microsoft.com/de-de/library/system.enum.toobject.aspx
So (with the appropriate import statements), the following should do:
Np = Enum.ToObject(NoisePath, 255)
Regards,
Markus Schaber
___________________________
We software Automation.
3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 |
Fax +49-831-54031-50
Email: m.schaber at 3s-software.com | Web: http://www.3s-software.com
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects:
http://www.3s-software.com/index.shtml?sample_projects
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner |
Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
More information about the Ironpython-users
mailing list