Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added dictionary for country collection #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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