locked
How to get the Country Code? RRS feed

  • Question

  • User1608082067 posted

    Hello,

    Does anyone knows how to get the country code from Current Thread when I have "en-US"?

    I know how to get the language code but not the country code.

    Thank You,

    Miguel

     

     

    Saturday, March 12, 2011 9:45 AM

Answers

All replies

  • User-837620913 posted

     

    Create a RegionInfo object using a CultureInfo object and calling LCID.
          // Creates a RegionInfo using a CultureInfo.LCID.
          RegionInfo myRI2 = new RegionInfo( new CultureInfo("en-US",false).LCID );
    

    RegionInfo has a ton of properties, one of which has what you need:  http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo.aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 12, 2011 10:03 AM
  • User-1083629820 posted

     

    RegionInfo regionInfo = new RegionInfo(System.Threading.Thread.CurrentThread.CurrentUICulture.LCID);
    
    Monday, March 14, 2011 6:10 AM