I have a country name like Australia and I would like to get the ISO 3166-1 alpha 2 code like AU in this case. Is there a way to easily do this in .NET?
There is nothing built in to convert a country name to its 2 alpha ISO code.
You can create a dictionary to map between the two.
var countryToISO2Map = new Dictionary<string,string>{
{"Australia", "AU"},
...
};