Good day everyone.

There is an XML file in which you need to parse double values. Please tell me how you can parse through double.Parse() . Here is the piece itself:

 <Width>245.50</Width> <IntersectionPlane> <X>0.000</X> <Y>0.000</Y> <Z>1.000</Z> </IntersectionPlane> <IntersectionPlane> <X>0.000</X> <Y>-300.000</Y> <Z>-0.000</Z> </IntersectionPlane> <IntersectionPlane> <X>-0.000</X> <Y>-0.000</Y> <Z>300.000</Z> </IntersectionPlane> 

File serialization was done via XmlSerializer respectively, reading via Deserialize . I tried to parse values ​​through string.Split() , it does not work. Tell me how it could be implemented. I wish there was something like this:

 round.Width = double.Parse(tokens[0]); plane.PlaneIntersection = new Point3D(ParseDouble(tokens[0]), ParseDouble(tokens[1]), ParseDouble(tokens[2])); 

ParseDouble(string digit): method code ParseDouble(string digit):

 private double ParseDouble(string digit) { double res; double.TryParse(digit, style, culture, out res); return res; } 
  • I don’t understand why you need to parse xml if you have already done Deserialize (i.e. you should already have some sort of array of objects of type IntersectionPlane where x, y and z are stored). Well and so look towards habrahabr.ru/post/24673 and msdn.microsoft.com/en-us/library/… - Murad

1 answer 1

Most likely, the problem is which decimal separator is set in the OS settings.