11using System . Collections . Generic ;
22
3+ #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
4+ using System . Diagnostics . CodeAnalysis ;
5+ #endif
6+
37namespace Nager . Country
48{
59 /// <summary>
6- /// ICountryProvider
10+ /// CountryProvider Interface
711 /// </summary>
812 public interface ICountryProvider
913 {
1014 /// <summary>
11- /// Get all country informations
15+ /// Retrieves information for all available countries.
1216 /// </summary>
13- /// <returns></returns>
17+ /// <returns>An <see cref="IEnumerable{ICountryInfo}"/> containing all country information. </returns>
1418 IEnumerable < ICountryInfo > GetCountries ( ) ;
1519
1620 /// <summary>
17- /// Get country by alpha2 or alpha3 code
21+ /// Retrieves information for a specific country by its ISO alpha-2 or alpha-3 code.
1822 /// </summary>
19- /// <param name="alpha2or3Code"></param>
20- /// <returns></returns>
23+ /// <param name="alpha2or3Code">The ISO alpha-2 or alpha-3 code of the country.</param>
24+ /// <returns>The <see cref="ICountryInfo"/> corresponding to the specified code.</returns>
25+ /// <exception cref="UnknownCountryException">Thrown if no country matches the provided code.</exception>
2126 ICountryInfo GetCountry ( string alpha2or3Code ) ;
2227
28+ #if NETSTANDARD2_0 || NET48
29+
2330 /// <summary>
24- /// Try get country by alpha2 or alpha3 code
31+ /// Attempts to retrieve country information by its ISO alpha-2 or alpha-3 code.
2532 /// </summary>
26- /// <param name="alpha2or3Code"></param>
27- /// <param name="countryInfo"></param>
28- /// <returns></returns>
33+ /// <param name="alpha2or3Code">The ISO alpha-2 or alpha-3 code of the country.</param>
34+ /// <param name="countryInfo">
35+ /// When this method returns, contains the <see cref="ICountryInfo"/>
36+ /// for the specified code if found; otherwise, null.
37+ /// </param>
38+ /// <returns>
39+ /// <c>true</c> if a country matching the specified code was found; otherwise, <c>false</c>.
40+ /// </returns>
2941 bool TryGetCountry ( string alpha2or3Code , out ICountryInfo ? countryInfo ) ;
3042
43+ #endif
44+
45+ #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
46+
47+ /// <summary>
48+ /// Attempts to retrieve country information by its ISO alpha-2 or alpha-3 code.
49+ /// </summary>
50+ /// <param name="alpha2or3Code">The ISO alpha-2 or alpha-3 code of the country.</param>
51+ /// <param name="countryInfo">
52+ /// When this method returns, contains the <see cref="ICountryInfo"/>
53+ /// for the specified code if found; otherwise, null.
54+ /// </param>
55+ /// <returns>
56+ /// <c>true</c> if a country matching the specified code was found; otherwise, <c>false</c>.
57+ /// </returns>
58+ bool TryGetCountry ( string alpha2or3Code , [ NotNullWhen ( true ) ] out ICountryInfo ? countryInfo ) ;
59+
60+ #endif
61+
3162 /// <summary>
32- /// Get country by alpha2 code
63+ /// Retrieves information about a country using its ISO 3166-1 alpha-2 code.
3364 /// </summary>
34- /// <param name="alpha2Code"></param>
35- /// <returns></returns>
65+ /// <param name="alpha2Code">The ISO alpha-2 code of the country.</param>
66+ /// <returns>The <see cref="ICountryInfo"/> corresponding to the specified code.</returns>
67+ /// <exception cref="UnknownCountryException">Thrown if no country matches the provided code.</exception>
3668 ICountryInfo GetCountry ( Alpha2Code alpha2Code ) ;
3769
3870 /// <summary>
39- /// Get country by alpha3 code
71+ /// Retrieves information about a country using its ISO 3166-1 alpha-3 code.
4072 /// </summary>
41- /// <param name="alpha3Code"></param>
42- /// <returns></returns>
73+ /// <param name="alpha3Code">The ISO alpha-3 code of the country.</param>
74+ /// <returns>The <see cref="ICountryInfo"/> corresponding to the specified code.</returns>
75+ /// <exception cref="UnknownCountryException">Thrown if no country matches the provided code.</exception>
4376 ICountryInfo GetCountry ( Alpha3Code alpha3Code ) ;
4477
4578 /// <summary>
@@ -50,7 +83,8 @@ public interface ICountryProvider
5083 /// GetCountryByNameConsiderTranslation -> <see href="https://github.com/nager/Nager.Country/blob/master/src/Nager.Country.Translation/CountryProviderExtension.cs>">CountryProviderExtension</see>
5184 /// </remarks>
5285 /// <param name="countryName"></param>
53- /// <returns></returns>
86+ /// <returns>The <see cref="ICountryInfo"/> corresponding to the specified code.</returns>
87+ /// <exception cref="UnknownCountryException">Thrown if no country matches the provided code.</exception>
5488 ICountryInfo GetCountryByName ( string countryName ) ;
5589 }
5690}
0 commit comments