A simple nuget package designed to:
- Retrieve a list of all countries.
- Fetch specific details about a country using its identifier.
Get All Countries:
- Retrieve a read-only list of all available countries, including their names and capitals.
Get Country by ID:
- Fetch detailed information about a specific country using its unique ID.
Custom Exception Handling:
- Throws a
CountryNotFoundExceptionwhen an invalid country ID is queried.
- Throws a
Thread-Safe Initialization:
- Ensures lazy and thread-safe initialization of country data.
Here’s how you can use the package to display all countries and details of Afghanistan:
usingWorld.Net;usingWorld.Net.Helpers;Console.WriteLine("All Countries:");varcountries=CountryProvider.GetAllCountries();foreach(varcountryincountries){Console.WriteLine($"Name: {country.Name}, Capital: {country.Capital}");}Console.WriteLine("\nDetails for Afghanistan:");varafghanistan=CountryProvider.GetCountry(CountryIdentifier.AfghanistanId);Console.WriteLine($"Official Name: {afghanistan.OfficialName}, Capital: {afghanistan.Capital}");Thanks to the following people who have contributed to this project:
