public static bool isValidState(string stateAbbr) { MexicanStateList list = MexicanStateListBuilder.getMexicanStateList(); return((from MexicanState state in list where state.Abbr == stateAbbr select state).Count() == 1); }
private static void buildMexicanStateList() { list = new MexicanStateList(); MexicanState mexicanState; foreach (string s in mexStates) { string[] parts = s.Split('('); string name = parts[0].Trim(); string abbr = parts[1].Substring(0, 3); mexicanState = new MexicanState() { Abbr = abbr, Name = name }; list.Add(mexicanState); } }