[IronPython] Typecasting in ironPython

saurabh rawat rawatsaurabh at yahoo.co.in
Fri Mar 18 08:24:11 CET 2011

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/acca24af/attachment.html>

More information about the Ironpython-users mailing list