Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3281398
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:48:41+00:00 2026-05-17T19:48:41+00:00

I’m using English Visual Studio 2008 on English Windows 7, but I’m based in

  • 0

I’m using English Visual Studio 2008 on English Windows 7, but I’m based in the Netherlands. A lot of my programs need to read and write floating point numbers. Compared to English, the Dutch notation of numbers switches the meaning of dots and comma’s (i.e. 1.001 in Dutch is a thousand and one, and 1,001 is 1 + 1/1000). I will never ever ever have to write (or read) numbers in Dutch format, but for some reason, every program I compile defaults to it, so every ToString() is wrong. This gets me every time. I know I can put this at the start of every thread:

System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

Or replace every instance of ToString() with:

String.Format(CultureInfo.InvariantCulture, "{0:0.####},{1:0.####}", x)

But sometimes I just want to compile something to see how it works, and not make any changes. Also, I’m bound to forget about this sometimes. Is there no way to just tell C#, .NET and/or Visual Studio to just always make all my projects/programs use the English number format?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:48:41+00:00Added an answer on May 17, 2026 at 7:48 pm

    It’s not a matter of compilation – it’s a matter of what happens at execution time. Unless you explicitly specify a culture, the current culture (at execution time) will be used. There’s no way of changing this behaviour that I’m aware of, which leaves you the options of:

    • Explicitly stating the culture to use
    • Explicitly changing the current culture

    Note that even if you change the current culture of the current thread, that may not affect things like the thread pool. Personally I think it’s better to always use the culture explicitly.

    You could always write your own extension methods to (say) call the original version but passing in CultureInfo.InvariantCulture. For example:

    public static string ToInvariantString(this IFormattable source, string format)
    {
        return source.Format(format, CultureInfo.InvariantCulture);
    }
    

    Getting that right everywhere could be a pain, admittedly… and to avoid boxing you’d actually want a slightly different signature:

    public static string ToInvariantString<T>(this T source, string format)
        where T : IFormattable
    {
        return source.Format(format, CultureInfo.InvariantCulture);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.