Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting string value from enum
Message
De
29/07/2008 17:49:30
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Getting string value from enum
Divers
Thread ID:
01335097
Message ID:
01335097
Vues:
57
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform