When is it advisable to use Invariant Culture?

Is it wrong to use InvariantCulture? And, if used, will it affect any global settings?

Dim hh As Decimal = 123456789.123456

' Is this an appropriate usage?
Dim ll As String = hh.ToString("N4", CultureInfo.InvariantCulture)
+5
source share
2 answers

Is CultureInfo.InvariantCulture using bad?

It all depends on what you are trying to achieve. If you are trying to format values ​​for machine readable, this is almost always the right thing to do. If you are trying to format them for users, this may not be appropriate.

Will this affect global culture?

Setting an invariant culture in a method call will not change the current current culture of the stream, if that is what you are worried about.

+7
source

Is CultureInfo.InvariantCulture using bad?

. - . , , , .

() , , , , InvariantCulture.

+6

All Articles