示例#1
0
        static CountyCache()
        {
            var table = Counties.GetAllCacheData();

            CountyNameDictionary =
                table.ToDictionary(row => MakeKey(row.StateCode, row.CountyCode),
                                   row => row.County, StringComparer.OrdinalIgnoreCase);

            CountiesByStateDictionary = table.GroupBy(row => row.StateCode)
                                        .ToDictionary(g => g.Key,
                                                      g => g.OrderBy(row => row.County, StringComparer.OrdinalIgnoreCase)
                                                      .Select(row => row.CountyCode)
                                                      .ToList()
                                                      .AsReadOnly());
        }