Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting string value from enum
Message
From
29/07/2008 17:49:30
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Getting string value from enum
Miscellaneous
Thread ID:
01335097
Message ID:
01335097
Views:
56
I am wondering about getting a string value from an enum. I have this enum:
public enum TagType
{
	MIXED		= 0,
	ISO6BG1		= 1,
	ISO6BG2		= 2,
	ISO6C		= 3,
	ICODE119	                     = 4,
	UCODE119	= 5,
	EPCC1G2		= 6
}
I need to pass into a method a string value indicating the TagType.
// Needs to be ultimately this.
this.reader.Attributes.SetTAGTYPE("EPCC1G2");
// Would simply like to do this
this.reader.Atrributes.SetTAGTYPE(TagType.EPCC1G2) but this is an int of 6

//Would this do it?  Ok, it doesn't but what does?
// Retrieve the TagType from the settings file as a TagType enumeration
string tagType = Enum.GetName(TagType, RfidSettings.Instance.TagType);
this.reader.Attributes.SetTAGTYPE(tagType);
Tim
Timothy Bryan
Next
Reply
Map
View

Click here to load this message in the networking platform