[IronPython] Typecasting in ironPython

Markus Schaber m.schaber at 3s-software.com
Fri Mar 18 08:59:01 CET 2011



Best 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 <mailto:m.schaber at 3s-software.com>  | Web: http://www.3s-software.com <http://www.3s-software.com> 
CoDeSys internet forum: http://forum.3s-software.com <http://forum-en.3s-software.com> 
Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?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 


Von: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] Im Auftrag von saurabh rawat
Gesendet: Freitag, 18. März 2011 08:24
An: users at lists.ironpython.com
Betreff: [IronPython] Typecasting in ironPython


HI , i am facing this problem of typecasting a given integer to a enum value.

following is the enum class

NoisePath np = (NoisePath)255 

public enum NoisePath
        NOISE_PATH_NONE = 0,
        NOISE_PATH_UPLINK = 1,
        NOISE_PATH_MIX = 3,
        NOISE_PATH_FM_RADIO = 5,

i tried  the following in Ipy code and got the following errors :

np = (NoisePath)255 

-->ERROR: Invalid Syntax , this comes at the time of script format checking , not even the function body gets executed

np = Convert.ToByte(255)
function(no) , hre function accepts the argument of type NoisePath 

-->ERROR: expected NoisePath, got Byte,this comes at the time of script execution ,at least some function body gets executed

Plz assist me on this.!!

Rgds and Thansk in advance !!



               " The ultimate test of a relationship is to disagree but to hold hands..............." 



[> ] 







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110318/9a849076/attachment.html>

More information about the Ironpython-users mailing list