public static IEnumerable <PostCodeRow> ReadRows(string allCountriesTxtPath) { foreach (var split in RowReader.ReadRows(allCountriesTxtPath)) { var row = new PostCodeRow { CountryCode = split[0], PostalCode = split[1], PlaceName = split[2], State = split[3], StateCode = split[4], Province = split[5], ProvinceCode = split[6], Community = split[7], CommunityCode = split[8], Latitude = double.Parse(split[9]), Longitude = double.Parse(split[10]), }; Assert.NotEmpty(row.PostalCode); var accuracy = split[11]; if (accuracy != null) { row.Accuracy = ushort.Parse(accuracy); } yield return(row); } }
public static IEnumerable <CountryInfo> ReadRows(string path) { foreach (var split in RowReader.ReadRows(path)) { CountryInfo row = new() { Iso = split[0] !, Iso3 = split[1] !, IsoNumeric = ushort.Parse(split[2] !), Fips = split[3] !, Name = split[4] !, Capital = split[5] !, //Population = uint.Parse(split[7]), Continent = split[8] !, TopLevelDomain = split[9] !, CurrencyCode = split[10] !, CurrencyName = split[11] !, PhonePrefix = split[12] !, PostCodeFormat = split[13] !, PostCodeRegex = split[14] !, }; var languages = split[15]; if (languages != null) { row.Languages = languages.Split(',').ToList(); } var s = split[6] !; row.Area = double.Parse(s); yield return(row); } } }