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

Ok, maybe this will do it. - fingers crossed
this.reader.Attributes.SetTAGTYPE(Enum.GetName(typeof(TagType), RfidSettings.Instance.TagType));
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform