iso3166 icon indicating copy to clipboard operation
iso3166 copied to clipboard

feat: Added dictionary for country collection

Open NelsonBN opened this issue 7 months ago • 0 comments

The idea is to have the countries information stored in a HashTable data structure, allowing us to reduce the lookup operation from O(n) to O(1).

E.g:

Country country = ISO3166.Country.Countries["DK"];
Country country = ISO3166.Country.Countries["dk"];

Also instantiated the dictionary with StringComparer.OrdinalIgnoreCase so the lookup operation can be case-insensitive.

To prevent breaking changes, the dictionary was created as ISO3166.Country.Countries and maintained ISO3166.Country.List, initializing it based on ISO3166.Country.Countries upon first use.

NelsonBN avatar Jul 05 '24 19:07 NelsonBN