Related: Get enum from enum attribute
I want the most maintainable way of binding an enumeration and it\'s associated localized string values to something.
You could just crash immediately if someone doesn't update it correctly.
public String GetString(SourceFilterOption option)
{
switch (option)
{
case SourceFilterOption.LastNumberOccurences:
return CR.LAST_NUMBER_OF_OCCURANCES;
case SourceFilterOption.LastNumberWeeks:
return CR.LAST_NUMBER_OF_WEEKS;
case SourceFilterOption.DateRange:
return CR.DATE_RANGE;
default:
throw new Exception("SourceFilterOption " + option + " was not found");
}
}