Given the following two cultures:
CultureInfo c1 = InvariantCulture; CultureInfo c2 = new CultureInfo("en-US");
and i were to examine every piece of information specific to both cultures, e.g.:
c1.DateTimeInfo.ShortDatePattern; c2.DateTimeInfo.ShortDatePattern; c1.DateTimeInfo.LongDatePattern; c2.DateTimeInfo.LongDatePattern; c1.NumberFormat.CurrencyDecimalDigits; c2.NumberFormat.CurrencyDecimalDigits; c1.TextInfo.IsRightToLeft; c2.TextInfo.IsRightToLeft;
Would i find any differences?
In other words, is the InvariantCulture, for all purposes, identical to the "en-US" culture?
The CultureInfo. InvariantCulture property is used if you are formatting or parsing a string that should be parseable by a piece of software independent of the user's local settings. The default value is CultureInfo. InstalledUICulture so the default CultureInfo is depending on the executing OS's settings.
You specify the invariant culture by name by using an empty string ("") in the call to a CultureInfo instantiation method. CultureInfo. InvariantCulture also retrieves an instance of the invariant culture. It can be used in almost any method in the System.
Yes.
For example: InvariantCulture uses the international symbol for currency: "¤" versus the dollar sign: "$" when formatting currency.
For the most part, however, they're very similar.
There are some actual differences (check both values in a Watch window), but the most relevant difference is the intent. InvariantCulture shows your intent of parsing some data in a culture independent, if english related, manner, whereas en-US declares your actual intent to parse data in a US specific manner.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With