Enumerations and String values in ASP.NET
        Posted  
        
            by Jason
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jason
        
        
        
        Published on 2010-05-22T22:47:36Z
        Indexed on 
            2010/05/22
            22:50 UTC
        
        
        Read the original article
        Hit count: 640
        
I'm looking for some best practice advice on enumerations and retrieving an associated string value. Given this:
public enum SerialKillers {
    TedBundy,
    EdGein,
    AlbertFish,
    GeorgeBush
}
What is the best way to get a related string value of the name? Eg. "Ted Bundy", given that the string value may not match the representation in the enumeration. eg "George W Bush"
My current thinking is function accepting an enum and returning a string, but would that not mean hard coding the string values (which I prefer not to do)? Is using a resources file where the string can be retrieved via the enumeration too heavy handed? Should I accept the fact I am going to Hell for victimising Ted Bundy by associating him with George Bush?
© Stack Overflow or respective owner