public static string ToString(CitiesEnum city) { string result = ""; switch (city) { case CitiesEnum.Mazatlan: result = "Mazatlán"; break; case CitiesEnum.Culiacan: result = "Culiacán"; break; case CitiesEnum.Rosario: result = "Rosario"; break; case CitiesEnum.Escuinapa: result = "Escuinapa"; break; default: result = ""; break; } return(result); }
public static CitiesEnum ToCitiesEnum(string city) { CitiesEnum result = CitiesEnum.None; switch (city.ToLowerInvariant()) { case "mazatlán": result = CitiesEnum.Mazatlan; break; case "culiacán": result = CitiesEnum.Culiacan; break; case "rosario": result = CitiesEnum.Rosario; break; case "escuinapa": result = CitiesEnum.Escuinapa; break; default: result = CitiesEnum.None; break; } return(result); }