Re: Non-locale-specific floating point numbers
- From: "Mike Schilling" <mscottschilling@xxxxxxxxxxx>
- Date: Mon, 29 Jan 2007 15:09:43 -0800
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.201ae69d3da29bd98d7d3@xxxxxxxxxxxxxxxxxxxxxxx
Mike Schilling <mscottschilling@xxxxxxxxxxx> wrote:
I want to write some C# that converts between floating-point numbers and
strings in a non-locale-specific way. That is, I want decimal points
always
to be ".", etc. The simple overloads of Double.ToString() and
Double.Parse() change their behavior depending on locale. I'm
considering
creating a static en-us locale and passing it to the overloads of Parse
and
ToString that take a locale, but is there a better way?
Instead of creating a static en-us, use CultureInfo.InvariantCulture.
Pass that to methods as appropriate.
Of course, you could always wrap that up in your own helper class if
you're doing it a lot.
Which is what I've done, thnks.
I can't be the only person with this requirement. Any program that defines
an invariant floating-point format (csc, for example) needs it.
.
- References:
- Non-locale-specific floating point numbers
- From: Mike Schilling
- Re: Non-locale-specific floating point numbers
- From: Jon Skeet [C# MVP]
- Non-locale-specific floating point numbers
- Prev by Date: Where is the Team Explorer downloade?
- Next by Date: Re: Is it possible to close a windows folder from C#?
- Previous by thread: Re: Non-locale-specific floating point numbers
- Next by thread: Re: My Service does not start automatically
- Index(es):
Relevant Pages
|
Loading