private void ZipCodeForm_Load(object sender, EventArgs e) { using (StreamReader sr = new StreamReader("zipcode.txt")) { string line; while ((line = sr.ReadLine()) != null) { string [] ss = line.Split('\t'); ZipCode zipcode = new ZipCode(ss[0], ss[1], ss[2], ss[3]); List <string> cities = (List <string>)(ptoc[zipcode.province]); if (cities == null) { cities = new List <string>(); ptoc.Add(zipcode.province, cities); this.province.Items.Add(zipcode.province); } cities.Add(zipcode.city); pandctoz.Add(zipcode.ToString(), zipcode); } } }
private void ZipCodeForm_Load(object sender, EventArgs e) { using (StreamReader sr = new StreamReader("zipcode.txt")) { string line; while ((line = sr.ReadLine()) != null) { string [] ss = line.Split('\t'); ZipCode zipcode = new ZipCode(ss[0], ss[1], ss[2], ss[3]); List<string> cities = (List<string>)(ptoc[zipcode.province]); if (cities == null) { cities = new List<string>(); ptoc.Add(zipcode.province, cities); this.province.Items.Add(zipcode.province); } cities.Add(zipcode.city); pandctoz.Add(zipcode.ToString(), zipcode); } } }