force 'normal' standards for parsing decimal numbers from string
I want to force my ASP.NET API to parse numbers as '102.28', currently it throws an error because it expects the format with a comma: '102,28'
7 Replies
Use the overload that takes an IFormatProvider
Decimal.Parse Method (System)
Converts the string representation of a number to its Decimal equivalent.
yes but, I am accepting the decimal as a form value
how can I force a global culture?
I don't know what this means
Are you calling Decimal.Parse?
[FromForm] decimal value
in asp.net web apiOk I have no idea how that works
ok np, thanks anyways
@mtreit
I needed to set
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
in Program.cs
before anything else
wait actually, it did not work :((((