ISO-3166 in the .NET Framework

    There was a need for one of the projects - to obtain its two-letter code by the name of the country in English.
    As you know, two-letter designations for the countries of the world are indicated in the ISO 3166-1 standard .
    The disappointment for me was that the .NET Framework does not directly support this standard.
    I had to invent my bike.

    What for?


    There are not so many existing bikes for .NET .
    In addition, the only option that was available at the time of solving the problem was updated already in 2012 and contained an array of countries with information about them.
    It’s clear that you won’t be particularly fed up with the search in the array, but there’s no point in framing the dictionary on top (why then put the library?
    The last straw was that after extracting the information from the CultureInfo.GetCultures
    country, suddenly a country called Andorra was not found.
    Is it really necessary to take something manually from the registry?

    What is the result?


    GitHub: Bia.Countries
    NuGet: Bia.Countries

    I will be glad to receive constructive comments!

    Also popular now: