public static LightPoint FromString(string strPoint) { string[] parts = strPoint.Split(new string[] { "position=<", " ", ",", "> velocity=<", ">" }, StringSplitOptions.RemoveEmptyEntries); LightPoint point = new LightPoint { X = Convert.ToInt32(parts[0]), Y = Convert.ToInt32(parts[1]), VX = Convert.ToInt32(parts[2]), VY = Convert.ToInt32(parts[3]), }; return(point); }
public LightField(string[] strPoints) { points = strPoints.Select(strPoint => LightPoint.FromString(strPoint)).ToList(); }