Aug 20, 2009 #1 Badgers Programmer Nov 20, 2001 187 US Hi, I have an enum, but I need to set it from the integer value for eg; enum parseData { Mem = 0, File = 1 } int testint = 0; parseData == testint; //This line gives me an error, any idea how to do this...? Thanks
Hi, I have an enum, but I need to set it from the integer value for eg; enum parseData { Mem = 0, File = 1 } int testint = 0; parseData == testint; //This line gives me an error, any idea how to do this...? Thanks
Aug 20, 2009 #2 jmeckley Programmer Jul 15, 2002 5,269 US something like Code: parseData == (parseData)Enum.ToObject(typeof(parseData),testint); basically you need to case the int to the Enum type. Jason Meckley Programmer Specialty Bakers, Inc. faq855-7190 Upvote 0 Downvote
something like Code: parseData == (parseData)Enum.ToObject(typeof(parseData),testint); basically you need to case the int to the Enum type. Jason Meckley Programmer Specialty Bakers, Inc. faq855-7190