Allow me to suggest going the route of behavior classes instead of enums. You'll eliminate switch statements completely and have the ability to associate meta data and behaviors on an item by item basis.
public class Gender
{
private static readonly Dictionary<string, Gender> _items = new Dictionary<string, Gender>();
public static readonly Gender Male = new Gender("M", "he", age => age >= 14);
public static readonly Gender Female = new Gender("F", "she", age => age >= 13);
public static readonly Gender Unknown = new Gender("U", "he/she", age => null);
public string DatabaseKey { get; private set; }
public string Pronoun { get; private set; }
public Func<int, bool?> CanGetMarriedInTexas { get; set; }
private Gender(string databaseKey, string pronoun, Func<int,bool?> canGetMarriedInTexas)
{
DatabaseKey = databaseKey;
Pronoun = pronoun;
CanGetMarriedInTexas = canGetMarriedInTexas;
_items.Add(databaseKey, this);
}
public static Gender GetForDatabaseKey(string databaseKey)
{
if (databaseKey == null)
{
return Unknown;
}
Gender gender;
if (!_items.TryGetValue(databaseKey, out gender))
{
return Unknown;
}
return gender;
}
public IEnumerable<Gender> All()
{
return _items.Values;
}
}
Instead of using a switch to get the database key you just ask for it:
public void MapViewToPerson(IEditPersonInfoView view, Person person)
{
person.Gender = view.Gender.DatabaseKey;
// ...
}
You can also apply gender specific behaviors by simply asking the Gender object for the information you want. For example, the legal marriage-with-consent age in Texas is gender specific.
public void MapPersonToView(IEditPersonInfoView view, Person person)
{
Gender gender = Gender.GetForDatabaseKey(person.Gender);
view.Gender = gender;
view.ShowMarriageSection = gender.CanGetMarriedInTexas(person.AgeInYears) ?? true;
// ...
}