Hello, dear!

The question arose how to use CultureInfo.InvariantCulture when enveloping strings on a date and in the case of money values ​​in double. With dates, everything seems to be clear. As I understand it CultureInfo.InvariantCulture says that the format in the received string corresponds to the format specified in the language settings of your computer. With the date I was convinced of this. However, in the case of a monetary value, the question arises as to why this:

double.Parse("2135.45", CultureInfo.InvariantCulture); 

normally converted and causes no exceptions. After all, the monetary format of Russia is indicated with a comma.

    1 answer 1

    Do not understand correctly. As stated here , this is a locale-independent language.

    • What is written there, I have already read. And how do you understand this? What does independent mean? If I specify a date in Japanese format, how will the CLR understand in what format I specified? Magic CultureInfo.InvariantCulture will not help her in this. ps In order to consolidate the theory with practice, I checked everything. And my understanding is based on practice. - t0di
    • four
      Свойство InvariantCulture получает экземпляр инвариантного языка и региональных параметров. Он связан с английским языком, но не связан ни с какой страной или регионом. This means that functions working with a locale are clogged on the system locale, and all of the default settings of the English language are parsed. If you specify a date in the Japanese format, it will not understand, and it will be parsed as English. - Chad
    • Now I understand everything! It’s just that the influence of the Anglo-slang prevents the Russian brain from understanding such words as invariant) @ Chad, that is, in essence CultureInfo.InvariantCulture replaces equivalently CultureInfo.CreateSpecificCulture ("en-US") ?? Or give me an example, if I misunderstood to the end - t0di
    • Well, it seems to me yes, although there probably is not quite "en-US", I think there are some differences from "en-US", most likely within the framework of the specificity of the US (that is, there is no specificity of the US). You just have to see the locale property. But the essence is true. - Chad