How to get the country code from CultureInfo?

后端 未结 5 2060
面向向阳花
面向向阳花 2021-01-01 10:17

I have the following:

System.Globalization.CultureInfo c = new System.Globalization.CultureInfo(\"en-GB\");

var a = c.DisplayName;
var b = c.EnglishName;
va         


        
5条回答
  •  悲哀的现实
    2021-01-01 10:44

    var c = new CultureInfo("en-GB");
    var r = new RegionInfo(c.LCID);
    string name = r.Name;
    

    Most probably you need to use r.TwoLetterISORegionName property.

    string regionName = r.TwoLetterISORegionName;
    

提交回复
热议问题