diff --git a/src/Nager.Country/AlphaCodeConversionExtensions.cs b/src/Nager.Country/AlphaCodeConversionExtensions.cs new file mode 100644 index 0000000..e3ce5dd --- /dev/null +++ b/src/Nager.Country/AlphaCodeConversionExtensions.cs @@ -0,0 +1,14 @@ +namespace Nager.Country; + +public static class AlphaCodeConversionExtensions +{ + public static Alpha3Code ToAlpha3Code( this Alpha2Code code ) + { + return (Alpha3Code)code; + } + + public static Alpha2Code ToAlpha2Code( this Alpha3Code code ) + { + return (Alpha2Code)code; + } +} \ No newline at end of file diff --git a/src/Nager.Country/CountryProviderExtensions.cs b/src/Nager.Country/CountryProviderExtensions.cs new file mode 100644 index 0000000..e0bb3a9 --- /dev/null +++ b/src/Nager.Country/CountryProviderExtensions.cs @@ -0,0 +1,15 @@ +namespace Nager.Country; + +public static class CountryProviderExtensions +{ + public static IEnumerable GetCountriesByRegion( this ICountryProvider provider, Region region ) + { + return provider.GetCountries().Where( x => x.Region == region ); + } + + public static IEnumerable GetCountriesBySubRegion( this ICountryProvider provider, + SubRegion subRegion ) + { + return provider.GetCountries().Where( x => x.SubRegion == subRegion ); + } +} \ No newline at end of file