I am trying to read a file with lines that are looking like this one:
2 59816.6667 22966.6667
Why do I get this exception when I want to run this code:
string[] lines = File.ReadAllLines(path);
var points = new List<Point>();
foreach (var line in lines)
{
var currentline = line.Split(' ');
points.Add(new Point(
double.Parse(currentline[1]),
double.Parse(currentline[2]),
double.Parse(currentline[0])
));
}
return points;
Point
class:
class Point
{
public Point(double x, double y, double iD)
{
X = x;
Y = y;
ID = iD;
}
public double X { get; set; }
public double Y { get; set; }
public double ID { get; set; }
}