Skip to content

Conversation

@NelsonBN
Copy link

@NelsonBN NelsonBN commented Jul 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant