46

I'm making multi culture plugin for MS Word,Excel where I need to identify setting value provided in Regional Settings under "List Separator" Option, how can I read using C# ?

This List separator is later on being used to construct Excel formulas, word mail merge header, etc.

shahjapan
  • 11,781
  • 21
  • 66
  • 98

1 Answers1

59

Try using System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator or System.Globalization.CultureInfo.GetCultureInfo("en-US").TextInfo.ListSeparator if you look for a specific culture's information.

floele
  • 3,526
  • 3
  • 32
  • 48
  • 2
    Just as a side note if you plan to use CurrentCulture: make sure there is no code that change the Thread Culture. `Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-CA");` http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx – Jeff Caron Apr 09 '13 at 12:56
  • 2
    If someone changes the current culture of the thread it's usually to make the new settings effect things like these (exports, format). That's why there are two current cultures: one for the thread and one for the UI (CurrentUICulture). Just make sure you are using the one you need, and don't worry if someone changes it. – Alex Mazzariol Nov 18 '13 at 08:34
  • 1
    To clarify @AlexMazzariol comment, which seems to imply that threads only have one culture: Threads have both CurrentCulture and CurrentUICulture. CurrentCulture determines formatting rules for dates, numbers, etc., while CurrentUICulture determines the language used. – Oskar Berggren Jul 25 '15 at 18:00