public static Prostokat Parse(SqlString s) { string value = s.Value; if (s.IsNull) { return(Null); } if (s.Value.Split(".".ToCharArray()).Length > 1) { throw new ArgumentException("Użyj przecinków zamiast kropek"); } string[] dane = s.Value.Split(" ".ToCharArray()); if (dane.Length < 8) { throw new ArgumentException("Za mała ilość argumentów"); } double ax = double.Parse(dane[0]); double ay = double.Parse(dane[1]); double bx = double.Parse(dane[2]); double by = double.Parse(dane[3]); double cx = double.Parse(dane[4]); double cy = double.Parse(dane[5]); double dx = double.Parse(dane[6]); double dy = double.Parse(dane[7]); Prostokat tmp = new Prostokat(ax, ay, bx, by, cx, cy, dx, dy); if (!tmp.SprawdzPunkty()) { throw new ArgumentException("Podane punkty nie tworzą prostokąta - " + "pamiętaj, podaj wartości z kolejnych wierzchołków"); } return(tmp); }