Esempio n. 1
0
        public static States ParseState(string state)
        {
            // See if the abbreviation matches one of the states:
            States result = States.Unknown;

            if (AbbreviationAttribute.TryFindAbbreviation <States>(state, true, ref result))
            {
                return(result);
            }

            // Try to parse the full state name:
            try {
                return((States)Enum.Parse(typeof(States), state, true));
            } catch {
                // Couldn't parse the full state name!
                return(States.Unknown);
            }
        }
Esempio n. 2
0
 public static string GetStateAbbreviation(States state)
 {
     return(AbbreviationAttribute.GetAbbrevation(state));
 }