dimanche 11 septembre 2016

Get Exact Name Of Enum Element In C#

I have an assembly file that defines an enum as the following:

public enum DataType{  
    @byte,  
    @short,  
    @int,  
    @long,
    ...  
}  

When I get its names by calling the typeof(DataType).GetEnumNames() or Enum.GetNames(typeof(DataType)) methods, I will get the following string literals:
["byte", "short", "int", "long", ...].
How can I get the exact name of the elements?
Is there any mistake in naming the enum elements?





Aucun commentaire:

Enregistrer un commentaire