/// <summary> /// get_address_by_prefix 通过地址前缀随机返回一个对应的地址 eg:北京市海淀-》北京市海淀区学院路x号 /// 返回GCJ-02坐标系 /// </summary> /// <param name="prefix"></param> /// <returns></returns> public static gps_base_model get_address_by_prefix_with_dictionary(string prefix) { prefix = op_dictionry_key(prefix); if (dictionary_static.Count == 0) { string key = string.Empty; var list = AddressUtil.get_gps_base_data_all_list(); foreach (var x in list) { key = op_dictionry_key(x.ads); if (dictionary_static.ContainsKey(key)) dictionary_static[key].Add(x); else dictionary_static.Add(key, new List<gps_base_model>() {x}); } } if (dictionary_static.ContainsKey(prefix).is_false()) return null; var ls = dictionary_static[prefix]; return ls[Utility.get_random_int_by_min_max(0, ls.Count - 1)]; }
标签:dictionary,get,eg,prefix,地址,static,key,北京市 From: https://www.cnblogs.com/IBPM/p/17039357.html