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

  • SEARCH
  • Home
  • 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 6371191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:01:50+00:00 2026-05-25T01:01:50+00:00

For instance: double d = 2.24; If Culture is ‘fr’ d.ToString() -> 2,24 If

  • 0

For instance:

double d = 2.24;

If Culture is ‘fr’

d.ToString() -> "2,24" 

If culture is ‘en’

d.ToString() -> "2.24" 

This implicit culture-based cast can generate lot of mistakes.

In aspx.cs

<script>
var n = <% Response.Write(d.ToString()); %> // if 'fr' n = 2,24 -> js syntax error
</script>

We can avoid that with

Convert.ToString(d, CultureInfo.InvariantCulture);

Is there any option to made this InvariantCulture by default for ToString()?

Any idea why it is done by Default?

  • 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-25T01:01:51+00:00Added an answer on May 25, 2026 at 1:01 am

    You could use the <globalization> element of your web.config and set a culture and a UI culture. For example:

    <system.web>
        <globalization culture="en-US" uiCulture="en-US">
    </system.web>
    

    By the way instead of:

    <script>
        var n = <% Response.Write(d.ToString()); %> // if 'fr' n = 2,24 -> js syntax error
    </script>
    

    I would recommend you to always use JavaScriptSerializer in order to JSON serialize the value when passing data to javascript:

    <script>
        var n = <%= new JavaScriptSerializer.Serialize(d) %>;
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make functions Double -> Double an instance of the Num typeclass.
Consider the double-check idiom for lazy initialization of instance fields: // Item 71 in
I’m trying to create an instance of: java.awt.geom.Point2D.Double in ColdFusion. Point2D.Double is a nested
How best can I convert instances of double backslashes to a single backslash in
For instance, if I have a list [1,4,2,3,5,4,5,6,7,8,1,3,4,5,9,10,11] This algorithm should return [1,2,3,4,5,6,7,8,9,10,11]. To
What is this double-colon :: ? E.g. Foo::Bar . I found a definition :
Do I have to double declare every new instance in c#? Obj sb =
Can someone post an example of how I get an instance variable value that
I am using java.awt.geom.Rectangle2D.Double class to generate a rectangle. I want to generate a
Can anyone name an instance of an application where clicking an entity (say image)

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.