How to get current regional settings in C#?

前端 未结 7 1660
独厮守ぢ
独厮守ぢ 2020-11-29 08:32

Normally you can get it by writing something like

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

But this way you can only ge

7条回答
  •  北海茫月
    2020-11-29 08:54

    There are the classes CultureInfo and TextInfo from the namespace System.Globalization. Both classes get several windows regional settings defined in the control panels. The list of available settings is in the documentation.

    For example:

    string separator = CultureInfo.CurrentCulture.TextInfo.ListSeparator;
    

    is getting the list separator for the program which is running.

提交回复
热议问题