S
S
Sergey2017-11-12 18:30:04
JavaScript
Sergey, 2017-11-12 18:30:04

How to parse double number in C#?

Hey!
Such a problem, I can not understand something.
I receive data from the client to the Asp net core server. Among these data there are numbers of type double .
ModelState complains about them:

{ "Latitude":["The value '55.157372256736146' is not valid for Latitude."],
  "Longitude":["The value '61.37220593627926' is not valid for Longitude."] }

And indeed, it is not parsed:
5a08685b333c8745527612.png
The data is sent through the FormData object , but before it was sent in json through the regular model, and it worked!
Experts, what am I missing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
frammmm, 2017-11-12
@korenb_white

Can it be like this double.Parse(s1, CultureInfo.InvariantCulture)
or like thisdouble.Parse(str.Replace('.', ','))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question