regioninfo

Refactoring two basic classes

How would you refactor these two classes to abstract out the similarities? An abstract class? Simple inheritance? What would the refactored class(es) look like? public class LanguageCode { /// <summary> /// Get the lowercase two-character ISO 639-1 language code. /// </summary> public readonly string Value; public L...

.NET RegionInfo class

When I try to create a new RegionInfo with certain ISO 3166 country codes ("BD" for Bangladesh, "SO" for Somalia, "LK" for Sri Lanka), I get an ArgumentException that says it's not recognized. What's the deal? The Intellisense of RegionInfo(string) says it conforms to ISO 3166, but these country/region codes are not supported? I don't...

How to find world region (or country) or language from the windows registry?

I'm working with a very old installer that can read Registry entries but has a difficulty (complex) time executing Windows APIs. I'm trying to detect whether the PC it's being installed on is in Australia. Any ideas? ...

Best Practice - Format Multiple Currencies

What is best practice for the scenario listed below? We have an application which we would like to support multiple currencies. The software will respect the users locale and regional settings to dictate the correct number format, i.e. $10,000.00 or 10.000,00₴ etc. We would however like to be able to format different numbers based upon...

How does one set text of two labels with two different cultural/region format options?

How does one set text of two labels with two different cultural/region format options? For first label to be ar-EG : Arabic - Egypt and second one to be en-US : English - United States ? This to be done for Number/Date/Time/Currency formats. ...

How to get DayNames from language only in .NET

Assume that I only have a country code (en, de, fr) and I need to display the weekdays in this language. I know about RegionInfo and CultureInfo - but I can't find a solution. If I create a country info from (for an example) "en" I have no DateTime info in it. It would also be OK to just take the first matching Region. For an example en-...