Minggu, 26 Desember 2010
How to Convert an Enum to its String Value
If you ever need to get the string value of an Enum member you can do so using the following technique rather than using a reverse lookup table:Electronic electronic = Electronic.Breakbeat; // value = "Breakbeat"; string value = Enum.GetName(typeof(Enums.Electronic), electronic); Where Electronic is an Enum declared like this:public enum Electronic{ AcidHouse, Ambient, BigBeat,
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar