Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enums

Status
Not open for further replies.

Badgers

Programmer
Nov 20, 2001
187
0
0
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



 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top