public PoiType(string csvContent) { string[] lines = csvContent.Replace("\r", "").Split('\n'); foreach (string line in lines) { if (line == "") { continue; } string[] categories = line.Split(','); if (categories.Length != 4) { continue; } if (!_typeCategoryDict.ContainsKey(categories[0])) { PoiCategory category = new PoiCategory(); category.BigCategory = categories[1]; category.MidCategory = categories[2]; category.SubCategory = categories[3]; _typeCategoryDict.Add(categories[0], category); } } }
public Dictionary <string, PoiCategory> GetTypeByCategoryKeyword(string keyword) { Dictionary <string, PoiCategory> result = new Dictionary <string, PoiCategory>(); foreach (KeyValuePair <string, PoiCategory> keyValuePair in _typeCategoryDict) { PoiCategory category = keyValuePair.Value; if (category.BigCategory.Contains(keyword) || category.MidCategory.Contains(keyword) || category.SubCategory.Contains(keyword)) { result.Add(keyValuePair.Key, keyValuePair.Value); } } return(result); }